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):
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 = [

2
crud_tests/views.py

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

Loading…
Cancel
Save