I'm creating a basic CMS. The CMS will contain information about different Entities.
A normal users can only see the information about the Entities but an editor will have access to an Dashboard were it can add new Entities or updated them.
I have an app Entity that use class-based view (CBV) for create,update,details,list-display (CRUD).
The urls for listing and details are: /entities and /entity-name
Because update and create are behind login and use different urls I create a second app Dashboard that use the create/update models of the Entity app
The urls are account/add and account/edit.
There is another solution to have different urls for views of the same model ?
I want the fist page of the dashboard to show different information based on the following logic(exist and/or is activated):
- if doesn't exist I want the CreateView (CBV) and corresponding form to appear
- if exist but it is not active a Pending message
- if exists and active the data of the entity
I can do the logic at the template level, but to separate things is better to be done at the CBV level. So in this case I need some help, how to implement it.
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^companies/', include('company.urls', namespace='company'))
urlpatterns = [
url(r'^$', CompanyListView.as_view(), name='list'),
url(r'^add/$', EntityCreateView.as_view(), name='create'),