from django.conf.urls import url from django.db import connection from crudbuilder.registry import registry from crudbuilder.views import ViewBuilder from crudbuilder import helpers helpers.auto_discover() urlpatterns = [] tables = connection.introspection.table_names() if tables: for app_model, base_crud in registry.items(): app, model = app_model.split('-') viewbuilder = ViewBuilder(app, model, base_crud) urls = [] pluralized = helpers.plural(model) list_view = viewbuilder.generate_list_view() update_view = viewbuilder.generate_update_view() detail_view = viewbuilder.generate_detail_view() create_view = viewbuilder.generate_create_view() delete_view = viewbuilder.generate_delete_view() entries = [ (r'^{}/{}/$', list_view.as_view(), '{}-{}-list'), (r'^{}/{}/(?P<pk>\d+)/$', detail_view.as_view(), '{}-{}-detail'), (r'^{}/{}/create/$', create_view.as_view(), '{}-{}-create'),
from django.conf.urls import url from django.db import connection from crudbuilder.registry import registry from crudbuilder.views import ViewBuilder, crudlist_view from crudbuilder import helpers helpers.auto_discover() urlpatterns = [ url(r'^$', crudlist_view, name='crud-index'), ] tables = connection.introspection.table_names() if 'django_content_type' in tables: for app_model, base_crud in registry.items(): app, model, postfix_url = app_model.split('-', 2) viewbuilder = ViewBuilder(app, model, base_crud) urls = [] list_view = viewbuilder.generate_list_view() update_view = viewbuilder.generate_update_view() detail_view = viewbuilder.generate_detail_view() create_view = viewbuilder.generate_create_view() delete_view = viewbuilder.generate_delete_view() entries = [ (r'^{}/{}/$', list_view.as_view(), '{}-{}-list'), (r'^{}/{}/create/$', create_view.as_view(), '{}-{}-create'),