From bec5d123caa336e03896bde54beb565d5dfde6dc Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Thu, 25 Feb 2016 09:55:51 -0300 Subject: [PATCH] Simplifica nome de parametros do Crud --- crud.py | 27 +++++++++++++-------------- crud_tests/views.py | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/crud.py b/crud.py index 6bd7855e2..80a2cff5b 100644 --- a/crud.py +++ b/crud.py @@ -249,33 +249,32 @@ class CrudDeleteMixin(FormMessagesMixin): class Crud(object): def __init__(self, model, help_path, layout, - crud_mixin=BaseCrudMixin, - crud_list_mixin=CrudListMixin, - crud_create_mixin=CrudCreateMixin, - crud_detail_mixin=CrudDetailMixin, - crud_update_mixin=CrudUpdateMixin, - crud_delete_mixin=CrudDeleteMixin, - ): - - class CrudMixin(crud_mixin): + base_mixin=BaseCrudMixin, + list_mixin=CrudListMixin, + create_mixin=CrudCreateMixin, + detail_mixin=CrudDetailMixin, + update_mixin=CrudUpdateMixin, + delete_mixin=CrudDeleteMixin): + + class CrudMixin(base_mixin): pass CrudMixin.model = model CrudMixin.help_path = help_path CrudMixin.layout = layout - class CrudListView(CrudMixin, crud_list_mixin, ListView): + class CrudListView(CrudMixin, list_mixin, ListView): pass - class CrudCreateView(CrudMixin, crud_create_mixin, CreateView): + class CrudCreateView(CrudMixin, create_mixin, CreateView): pass - class CrudDetailView(CrudMixin, crud_detail_mixin, DetailView): + class CrudDetailView(CrudMixin, detail_mixin, DetailView): pass - class CrudUpdateView(CrudMixin, crud_update_mixin, UpdateView): + class CrudUpdateView(CrudMixin, update_mixin, UpdateView): pass - class CrudDeleteView(CrudMixin, crud_delete_mixin, DeleteView): + class CrudDeleteView(CrudMixin, delete_mixin, DeleteView): pass self.urlpatterns = [ diff --git a/crud_tests/views.py b/crud_tests/views.py index 9255c1938..60aad8743 100644 --- a/crud_tests/views.py +++ b/crud_tests/views.py @@ -15,4 +15,4 @@ country_crud = Crud( ], ['More Details', [('description', 12)]], ], - crud_list_mixin=CountryCrudListMixin) + list_mixin=CountryCrudListMixin)