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

Error in model field image #5

Closed marcoshemann closed 8 years ago

marcoshemann commented 8 years ago

I am using a model with a field image (models.py) Cadastro logo = models.ImageField(upload_to = gera_caminho_cad, blank=True)

in view.py class CadastroCrud(BaseCrudBuilder): model = Cadastro modelform_excludes = ['logo'] ...

And when i click Id in list view, to show me detail view, i get this error:

Exception Value:
The 'imagem' attribute can only be accessed from Contato instances. Exception Location: /home/wm.0.2/lib/python3.4/site-packages/django/db/models/fields/files.py in get, line 176

Error during template rendering

In template /home/wm.0.2/des/cadastro/templates/cadastro/crud/crud_detail.html, error at line 27

Template 27 {% for field in object|get_model_fields %} <-- ERROR

asifpy commented 8 years ago

Template tag error resolved here : https://github.com/asifpy/django-crudbuilder/commit/5cf7654780e101d1749233e8b760a21a16f88db9#diff-7965a9755a9fbd3f48eaddc1ff376cd4

marcoshemann commented 8 years ago

Perfect, thank you. Congratulations for the project.