Browse Source

Simplifica nome de parametros do Crud

pull/237/head
Marcio Mazza 9 years ago
parent
commit
bec5d123ca
  1. 27
      crud.py
  2. 2
      crud_tests/views.py

27
crud.py

@ -249,33 +249,32 @@ class CrudDeleteMixin(FormMessagesMixin):
class Crud(object): class Crud(object):
def __init__(self, model, help_path, layout, def __init__(self, model, help_path, layout,
crud_mixin=BaseCrudMixin, base_mixin=BaseCrudMixin,
crud_list_mixin=CrudListMixin, list_mixin=CrudListMixin,
crud_create_mixin=CrudCreateMixin, create_mixin=CrudCreateMixin,
crud_detail_mixin=CrudDetailMixin, detail_mixin=CrudDetailMixin,
crud_update_mixin=CrudUpdateMixin, update_mixin=CrudUpdateMixin,
crud_delete_mixin=CrudDeleteMixin, delete_mixin=CrudDeleteMixin):
):
class CrudMixin(base_mixin):
class CrudMixin(crud_mixin):
pass pass
CrudMixin.model = model CrudMixin.model = model
CrudMixin.help_path = help_path CrudMixin.help_path = help_path
CrudMixin.layout = layout CrudMixin.layout = layout
class CrudListView(CrudMixin, crud_list_mixin, ListView): class CrudListView(CrudMixin, list_mixin, ListView):
pass pass
class CrudCreateView(CrudMixin, crud_create_mixin, CreateView): class CrudCreateView(CrudMixin, create_mixin, CreateView):
pass pass
class CrudDetailView(CrudMixin, crud_detail_mixin, DetailView): class CrudDetailView(CrudMixin, detail_mixin, DetailView):
pass pass
class CrudUpdateView(CrudMixin, crud_update_mixin, UpdateView): class CrudUpdateView(CrudMixin, update_mixin, UpdateView):
pass pass
class CrudDeleteView(CrudMixin, crud_delete_mixin, DeleteView): class CrudDeleteView(CrudMixin, delete_mixin, DeleteView):
pass pass
self.urlpatterns = [ self.urlpatterns = [

2
crud_tests/views.py

@ -15,4 +15,4 @@ country_crud = Crud(
], ],
['More Details', [('description', 12)]], ['More Details', [('description', 12)]],
], ],
crud_list_mixin=CountryCrudListMixin) list_mixin=CountryCrudListMixin)

Loading…
Cancel
Save