Closed igabice closed 6 years ago
Hi, I am not sure if this work, but you can overwrite the get_FOO_display https://docs.djangoproject.com/en/2.0/ref/models/instances/#django.db.models.Model.get_FOO_display
django-cruds-adminlte first check if get_FOO_display if found call this function.
Hmm, for the list you can just extend the templates/cruds/columns/filefield.html
or change a bit the
code (PR is welcome!) and create a custom field for the images (something like imagefield would be really nice).
For the detail view we're using the html from django-image-cropping
(https://github.com/jonasundderwolf/django-image-cropping) so, I think the right way is to look for how to extend it in the docs of the project.
Please keep me updated with the progress.
i added the code below in the filefield.html located at cruds_adminlte/templates/cruds/columns/filefield.html the image now displays in list view but i only get the link when in detail view.
<img src="{{ object.image.url }}" alt="image" style="width:400px; max-height:600px" />
Yeah @igabice that is a solution, but instead to add code to filefield.html
you can create your own one and put the code there. Or even better, as I've said above, create a imagefield
type and put the code in a imagefield.html
and PR ;).
For the detail view you should take a look to the django-image-cropping project.
TBH would be a really nice feature to have imagefield
as field type (list) and the widget (detail) with the html in our project, just to not depend on others. Let's see if we can add it in next release.
hello, thanks for this wonderful app, it saved me a lot time. I have a model with an imageField, i would like to display the actual image but instead i get the name of the image in both the list and detail view and only when the name is clicked can i see the image. please how can i make the image display in both list and detail view?