18👍
✅
I’ve solved this by adding:
def image_thumb(self):
return '<img src="/media/%s" width="100" height="100" />' % (self.photo)
image_thumb.allow_tags = True
to the model in models.py
5👍
There have been some fairly detailed answers to this question in the past, try this link.
- [Django]-How do I programmatically create a user with django_social_auth?
- [Django]-Accessing user home directory from django
4👍
By the way, for all noobies like me:
It works also in StackedInline and TabularInline, but if you use this solution, you should add in admin.py:
fields = (..., 'image_thumb', ...) # as you have expected
readonly_fields = ['image_thumb'] # without this there will be traceback
- [Django]-Django: Values_list returns id from choice field instead of name
- [Django]-Django session lost when redirected from facebook oauth
- [Django]-Monitoring django postgres connections
Source:stackexchange.com