config = DartCMSConfig({ 'model': SiteUser, 'grid': { 'grid_columns': [ { 'field': SiteUser.USERNAME_FIELD, 'width': '60%' }, { 'field': 'last_login', 'width': '20%' }, { '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 } })
from .forms import ProductSectionForm from .views import (AppendSectionView, GetTreeView, InsertSectionView, MoveSectionView) ProductSection = get_model('shop', 'ProductSection') config = DartCMSConfig({ 'model': ProductSection, 'parent_kwarg_name': 'catalog', 'parent_model_fk': 'catalog_id', 'grid': { 'grid_columns': [ {'field': 'name', 'width': '90%'}, {'field': 'is_visible', 'width': '10%'}, ], 'template_name': 'dartcms/apps/shop/grid.html', 'additional_grid_actions': [ {'url': 'products', 'label': _('Products')} ] }, 'form': { 'form_class': ProductSectionForm, }, }) insert_kwargs = config.form.copy() insert_kwargs['template_name'] = 'dartcms/apps/pages/insert.html' update_kwargs = config.form.copy() update_kwargs['template_name'] = 'dartcms/apps/pages/update.html'
config = DartCMSConfig({ 'model': Product, 'parent_kwarg_name': 'section', 'parent_model_fk': 'section_id', 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '40%' }, { 'field': 'code', 'width': '20%' }, { 'field': 'manufacturer', 'width': '20%' }, { 'field': 'residue', 'width': '10%' }, { 'field': 'price', 'width': '10%' }, ] }, 'form': { 'form_class': ProductForm, } })
from .views import (DeleteMessageFormView, InsertMessageFormView, MessagesGridView, UpdateMessageFormView) app_name = 'feedback_messages' config = DartCMSConfig({ 'parent_kwarg_name': 'form_type', 'parent_model_fk': 'type_id', 'grid': { 'base_grid_actions': ['update', 'delete', 'insert'], 'grid_columns': [ { 'field': 'author', 'width': '80%', 'label': _('Author') }, { 'field': 'date_created', 'width': '20%', 'label': _('Date_created') }, ] } }) urlpatterns = [ url(r'^$', MessagesGridView.as_view(**config.grid), name='index'), url(r'^insert/$', InsertMessageFormView.as_view(**config.form), name='insert'),
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'])
# 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'), ]
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'])
# coding: utf-8 from dartcms.apps.ads.models import AdPlace from dartcms.utils.config import DartCMSConfig from django.forms import modelform_factory app_name = 'adplace' config = DartCMSConfig({ 'model': AdPlace, 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '80%' }, { 'field': 'is_enabled', 'width': '20%' }, ], 'base_grid_actions': ['update'] }, 'form': { 'form_class': modelform_factory(AdPlace, exclude=['slug']), }, }) urlpatterns = config.get_urls(exclude=['insert', 'delete'])
config = DartCMSConfig({ 'model': Ad, 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '30%' }, { 'field': 'place', 'width': '20%' }, { 'field': 'date_from', 'width': '20%' }, { 'field': 'date_to', 'width': '20%' }, { 'field': 'is_enabled', 'width': '10%' }, ] }, 'form': { 'form_class': modelform_factory(Ad, exclude=[]), } })
Order = get_model('shop', 'Order') config = DartCMSConfig({ 'model': Order, 'grid': { 'grid_columns': [ {'field': 'order_number', 'width': '10%', 'label': _('#')}, {'field': 'date_created', 'width': '20%'}, {'field': 'fullname', 'width': '30%'}, {'field': 'status', 'width': '10%'}, {'field': 'shipping_type', 'width': '10%'}, {'field': 'payment_type', 'width': '10%'}, {'field': 'total', 'width': '10%', 'label': _('Total')} ], 'search': [ 'fullname', 'date_created' ], 'base_grid_actions': ['update'], 'additional_grid_actions': [ {'url': 'details', 'label': _('Details')} ], 'model_properties': ['order_number', 'total'] }, 'form': { 'form_class': OrderForm } }) urlpatterns = [ url(r'^$', GridView.as_view(**config.grid), name='index'),
config = DartCMSConfig({ 'model': Page, 'grid': { 'grid_columns': [ { 'field': 'title', 'width': '60%' }, { 'field': 'url', 'width': '20%' }, { 'field': 'module', 'width': '20%' }, ], 'template_name': 'dartcms/apps/pages/grid.html', 'search': ['title', 'url', 'module'], 'additional_grid_actions': [{ 'url': 'open_url', 'kwarg_name': 'pk', 'label': _('Open URL'), 'icon': 'chevron', 'target': '_blank' }] }, 'form': { 'form_class': PageForm, 'tabs': True } })
from .models import FormType app_name = 'feedback' config = DartCMSConfig({ 'model': FormType, 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '70%' }, { 'field': 'slug', 'width': '30%' }, ], 'additional_grid_actions': [{ 'url': 'messages', 'kwarg_name': 'form_type', 'include_urls': 'dartcms.apps.feedback.messages.urls' }] }, }) urlpatterns = config.get_urls()
Ad = get_model('ads', 'Ad') config = DartCMSConfig({ 'model': Ad, 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '30%' }, { 'field': 'place', 'width': '20%' }, { 'field': 'date_from', 'width': '20%' }, { 'field': 'date_to', 'width': '20%' }, { 'field': 'is_enabled', 'width': '10%' }, ] } }) urlpatterns = config.get_urls()
config = DartCMSConfig({ 'model': ProductSection, 'parent_kwarg_name': 'catalog', 'parent_model_fk': 'catalog_id', 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '90%' }, { 'field': 'is_visible', 'width': '10%' }, ], 'template_name': 'dartcms/apps/shop/grid.html', 'additional_grid_actions': [{ 'url': 'products', 'label': _('Products'), 'kwarg_name': 'section', 'include_urls': 'dartcms.apps.shop.product.urls' }] }, 'form': { 'form_class': ProductSectionForm, }, })
# coding: utf-8 from dartcms.apps.ads.models import AdSection from dartcms.utils.config import DartCMSConfig app_name = 'adsection' config = DartCMSConfig({ 'model': AdSection, 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '80%' }, { 'field': 'is_enabled', 'width': '20%' }, ] } }) urlpatterns = config.get_urls()
FeedItem = get_model('feeds', 'FeedItem') config = DartCMSConfig({ 'model': FeedItem, 'parent_kwarg_name': 'feed', 'parent_model_fk': 'feed_id', 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '60%' }, { 'field': 'is_visible', 'width': '20%' }, { 'field': 'date_published', 'width': '20%' }, ], 'search': ['name', 'date_published', 'is_visible'] }, 'form': { 'form_class': FeedItemForm, } }) urlpatterns = [ url(r'^$', GridView.as_view(**config.grid), name='index'),
from dartcms.utils.config import DartCMSConfig from dartcms.utils.loading import get_model from dartcms.views import (DeleteObjectView, GridView, InsertObjectView, UpdateObjectView) Feed = get_model('feeds', 'Feed') config = DartCMSConfig({ 'model': Feed, 'grid': { 'grid_columns': [ {'field': 'type', 'width': '10%'}, {'field': 'name', 'width': '90%'}, ], 'additional_grid_actions': [ {'url': 'items'} ] }, 'form': { 'form_class': modelform_factory(Feed, 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'), url(r'^(?P<children_url>items)/(?P<feed>\d+)/', include('dartcms.apps.feeds.items.urls', namespace='feed_items')), ]
# -*- coding: utf-8 -*- from django.conf.urls import url from django.forms.models import modelform_factory from dartcms.apps.users.models import UserGroup from dartcms.utils.config import DartCMSConfig from dartcms.views import (DeleteObjectView, GridView, InsertObjectView, UpdateObjectView) config = DartCMSConfig({ 'model': UserGroup, 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '100%' }, ] }, 'form': { 'form_class': modelform_factory(model=UserGroup, exclude=['users']) } }) 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),
config = DartCMSConfig({ 'model': Order, 'grid': { 'grid_columns': [{ 'field': 'order_number', 'width': '10%', 'label': _('#') }, { 'field': 'date_created', 'width': '20%' }, { 'field': 'fullname', 'width': '30%' }, { 'field': 'status', 'width': '10%' }, { 'field': 'shipping_type', 'width': '10%' }, { 'field': 'payment_type', 'width': '10%' }, { 'field': 'total', 'width': '10%', 'label': _('Total') }], 'search': ['fullname', 'date_created'], 'base_grid_actions': ['update'], 'additional_grid_actions': [{ 'url': 'details', 'label': _('Details'), 'kwarg_name': 'order', 'include_urls': 'dartcms.apps.shop.order_detail.urls' }], 'model_properties': ['order_number', 'total'] }, 'form': { 'form_class': OrderForm } })
from dartcms.views import (DeleteObjectView, GridView, InsertObjectView, UpdateObjectView) from .models import FormType config = DartCMSConfig({ 'model': FormType, 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '70%' }, { 'field': 'slug', 'width': '30%' }, ], 'additional_grid_actions': [{ 'url': 'messages' }] }, 'form': { 'form_class': modelform_factory(FormType, 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+)/$',
UpdatePageView) Page = get_model('pages', 'Page') config = DartCMSConfig({ 'model': Page, 'grid': { 'grid_columns': [ { 'field': 'title', 'width': '60%' }, { 'field': 'url', 'width': '20%' }, { 'field': 'module', 'width': '20%' }, ], 'template_name': 'dartcms/apps/pages/grid.html' }, 'form': { 'form_class': PageForm, } }) insert_kwargs = config.form.copy() insert_kwargs['template_name'] = 'dartcms/apps/pages/insert.html'
config = DartCMSConfig({ 'model': User, 'grid': { 'grid_columns': [ { 'field': 'username', 'width': '60%' }, { 'field': 'last_login', 'width': '20%' }, { 'field': 'is_staff', 'width': '10%' }, { 'field': 'is_active', 'width': '10%' }, ], 'additional_grid_actions': [{ 'url': 'change-password', 'label': _('Change Password'), 'icon': 'edit' }], }, 'form': { 'form_class': UserForm } })
Feed = get_model('feeds', 'Feed') config = DartCMSConfig({ 'model': Feed, 'grid': { 'grid_columns': [ { 'field': 'type', 'width': '10%' }, { 'field': 'name', 'width': '90%' }, ], 'additional_grid_actions': [{ 'url': 'items', 'kwarg_name': 'feed', 'include_urls': 'dartcms.apps.feeds.items.urls' }] }, 'form': { 'form_class': modelform_factory(Feed, exclude=[]), } }) urlpatterns = config.get_urls()
config = DartCMSConfig({ 'model': ProductCatalog, 'grid': { 'grid_columns': [ { '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 } })
ProductCatalog = get_model('shop', 'ProductCatalog') config = DartCMSConfig({ 'model': ProductCatalog, 'grid': { 'grid_columns': [ { 'field': 'name', 'width': '50%' }, { 'field': 'slug', 'width': '40%' }, { 'field': 'is_visible', 'width': '10%' }, ], 'additional_grid_actions': [{ 'url': 'sections', 'label': _('Sections') }] }, 'form': { 'form_class': ProductCatalogForm } }) urlpatterns = [ url(r'^$', GridView.as_view(**config.grid), name='index'),