def get_urls(self, exclude=None): if exclude is None: exclude = [] urls = [] if 'index' not in exclude: urls += [url(r'^$', GridView.as_view(**self.grid), name='index')] if 'insert' not in exclude: insert_view = InsertObjectWithInlinesView if 'inlines' in self.form else InsertObjectView urls += [url(r'^insert/$', insert_view.as_view(**self.form), name='insert')] if 'update' not in exclude: update_view = UpdateObjectWithInlinesView if 'inlines' in self.form else UpdateObjectView urls += [url(r'^update/(?P<pk>[0-9a-f-]+)/$', update_view.as_view(**self.form), name='update')] if 'delete' not in exclude: if not self.grid.get('single_select', True): urls += [ url(r'^delete/(?P<pks>[0-9a-f-,]+)/$', DeleteMultipleObjectView.as_view(**self.base), name='delete')] else: urls += [url(r'^delete/(?P<pk>[0-9a-f-]+)/$', DeleteObjectView.as_view(**self.base), name='delete')] if 'addition' not in exclude and 'additional_grid_actions' in self.grid: for action in self.grid.get('additional_grid_actions', []): if 'kwarg_name' in action: pattern = r'^(?P<children_url>{url})/(?P<{kwarg_name}>[0-9a-f-]+)/' else: pattern = r'^(?P<children_url>{url})/' if 'include_urls' in action: urls += [url(pattern.format(**action), include(action['include_urls'], namespace=action['url']))] else: urls += [url(pattern.format(**action), action['view'], name=action['url'])] return urls
}, { 'field': 'is_active', 'width': '10%' }, ], 'additional_grid_actions': [{ 'url': 'change-password', 'label': _('Change Password'), 'icon': 'edit' }], }, 'form': { 'form_class': UserForm } }) urlpatterns = [ url(r'^$', GridView.as_view(**config.grid), name='index'), url(r'^insert/$', CMSUserInsertView.as_view(**config.form), name='insert'), url(r'^update/(?P<pk>\d+)/$', CMSUserUpdateView.as_view(**config.form), name='update'), url(r'^delete/(?P<pk>\d+)/$', DeleteObjectView.as_view(**config.base), name='delete'), url(r'^change-password/(?P<pk>\d+)/$', ChangePasswordView.as_view(), name='change_password'), ]
# coding: utf-8 from django.conf.urls import url from django.forms import modelform_factory from dartcms.apps.ads.models import AdSection from dartcms.utils.config import DartCMSConfig from dartcms.views import (DeleteObjectView, GridView, InsertObjectView, UpdateObjectView) config = DartCMSConfig({ 'model': AdSection, 'grid': { 'grid_columns': [ {'field': 'name', 'width': '80%'}, {'field': 'is_enabled', 'width': '20%'}, ] }, 'form': { 'form_class': modelform_factory(AdSection, exclude=[]), } }) urlpatterns = [ url(r'^$', GridView.as_view(**config.grid), name='index'), url(r'^insert/$', InsertObjectView.as_view(**config.form), name='insert'), url(r'^update/(?P<pk>\d+)/$', UpdateObjectView.as_view(**config.form), name='update'), url(r'^delete/(?P<pk>\d+)/$', DeleteObjectView.as_view(**config.base), name='delete'), ]
# coding: utf-8 from django.conf.urls import url from dartcms.views import (DeleteObjectView, GridView, InsertObjectView, UpdateObjectView) urlpatterns = [ url(r'^$', GridView.as_view(search=['name']), name='index'), url(r'^insert/$', InsertObjectView.as_view(), name='insert'), url(r'^update/(?P<pk>\d+)/$', UpdateObjectView.as_view(), name='update'), url(r'^delete/(?P<pk>\d+)/$', DeleteObjectView.as_view(), name='delete'), ]