{ 'field': 'name', 'width': '50%' }, { 'field': 'slug', 'width': '40%' }, { 'field': 'is_visible', 'width': '10%' }, ], 'additional_grid_actions': [{ 'url': 'sections', 'label': _('Sections'), 'kwarg_name': 'catalog', 'include_urls': 'dartcms.apps.shop.section.urls' }] }, 'form': { 'form_class': ProductCatalogForm } }) urlpatterns = config.get_urls()
app_name = 'sitesettings' config = DartCMSConfig({ 'model': SiteSettings, 'grid': { 'grid_columns': [ { 'field': 'description', 'width': '20%' }, { 'field': 'type_display', 'width': '20%', 'label': _('Type') }, { 'field': 'value_for_grid', 'width': '60%', 'label': _('Value') }, ], 'base_grid_actions': ['update'], 'model_properties': ['type_display', 'value_for_grid'] }, 'form': { 'form_class': SiteSettingsForm, } }) urlpatterns = config.get_urls(exclude=['insert', 'delete'])
'kwarg_name': 'section', 'include_urls': 'dartcms.apps.shop.product.urls' }] }, 'form': { 'form_class': ProductSectionForm, }, }) insert_kwargs = config.form.copy() insert_kwargs['template_name'] = 'dartcms/views/insert.html' update_kwargs = config.form.copy() update_kwargs['template_name'] = 'dartcms/views/update.html' urlpatterns = config.get_urls(exclude=['insert', 'update']) + [ url(r'^get-tree/$', csrf_exempt(GetTreeView.as_view(**config.grid)), name='get_tree'), url(r'^insert/$', InsertSectionView.as_view(**insert_kwargs), name='insert'), url(r'^append/$', csrf_exempt(AppendSectionView.as_view()), name='append'), url(r'^move/$', csrf_exempt(MoveSectionView.as_view()), name='move'), url(r'^update/(?P<pk>\d+)/$', UpdateObjectView.as_view(**update_kwargs), name='update'), ]
}, { 'field': 'is_staff', 'width': '10%' }, { 'field': 'is_active', 'width': '10%' }, ], 'search': [SiteUser.USERNAME_FIELD, 'email'], 'additional_grid_actions': [{ 'url': 'change-password', 'label': _('Change Password'), 'icon': 'edit', 'required_permissions': '__all__', 'kwarg_name': 'pk' }], 'model_properties': [SiteUser.USERNAME_FIELD] }, 'form': { 'form_class': UserForm } }) urlpatterns = config.get_urls(exclude=['addition']) + [ url(r'^change-password/(?P<pk>\d+)/$', ChangePasswordView.as_view(), name='change_password'), ]
'search': [CMSUser.USERNAME_FIELD, 'email'], 'additional_grid_actions': [{ 'url': 'change-password', 'label': _('Change Password'), 'icon': 'edit', 'required_permissions': '__all__', 'kwarg_name': 'pk' }], 'model_properties': [CMSUser.USERNAME_FIELD] }, 'form': { 'form_class': UserForm } }) urlpatterns = config.get_urls( exclude=['addition', 'insert', 'update', 'delete']) + [ 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'), ]
Order = get_model('shop', 'OrderDetail') config = DartCMSConfig({ 'model': Order, 'parent_kwarg_name': 'order', 'parent_model_fk': 'order_id', 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '60%' }, { 'field': 'price', 'width': '20%' }, { 'field': 'quantity', 'width': '20%' }, ], 'base_grid_actions': ['update', 'delete'], }, 'form': { 'form_class': OrderDatailForm } }) urlpatterns = config.get_urls(exclude=['insert'])