asifpy / django-crudbuilder

Generic CRUD implementation in Django
https://django-crudbuilder.readthedocs.org/en/latest/index.html
Apache License 2.0
193 stars 67 forks source link

Hi, I fix now #32

Closed marcoshemann closed 8 years ago

marcoshemann commented 8 years ago

Hi, Please look this sugest to exclude some field in DetailView, to dont show any field. usage: In MyCrud(BaseCrudBuilder): etailview_excludes = [ 'parent','mptt_level', 'id', ]

and this fields wont show in detail.

Resume: In tags.py add a exclude parameter get_model_fields(obj, exclude=[]): ... getattr(model, name, None), property ): property_fields.append(Field(name=name, verbose_name=name)) ret = chain(obj._meta.fields, property_fields) return [i for i in ret if i.name not in exclude]

In template: add a context variable with a list of exclude fields. {% for field in object|get_model_fields:exclude %}

In view.py def generate_detail_view(self): add : detailview_excludes = self.detailview_excludes,

in abstract.py class BaseBuilder(object): self.detailview_excludes = self._has_crud_attr('detailview_excludes')

and finaly in mixin.py class CrudBuilderMixin def get_context_data( try: context['exclude'] = self.detailview_excludes except: context['exclude'] =None

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.2%) to 79.167% when pulling a293b7663f77caab9530239d74562549822c5092 on marcoshemann:master into c965ec5c7a46773c03134d6c10702945e42d05c3 on asifpy:master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.2%) to 79.167% when pulling a293b7663f77caab9530239d74562549822c5092 on marcoshemann:master into c965ec5c7a46773c03134d6c10702945e42d05c3 on asifpy:master.