refactored
This commit is contained in:
parent
eaa1795f0c
commit
91790bbc39
|
|
@ -6,7 +6,7 @@ from gallery.models import Image
|
|||
@admin.register(Image)
|
||||
class ImageModelAdmin(admin.ModelAdmin):
|
||||
"""Image model admin."""
|
||||
list_display = ['id', 'title', 'image_tag', 'orientation_display']
|
||||
list_display = ['id', 'title', 'orientation_display', 'image_tag', ]
|
||||
|
||||
def orientation_display(self, obj):
|
||||
"""Get image orientation name."""
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ class NewsDocument(Document):
|
|||
'slug',
|
||||
'state',
|
||||
'is_highlighted',
|
||||
'image_url',
|
||||
'preview_image_url',
|
||||
'template',
|
||||
)
|
||||
related_models = [models.NewsType]
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class SORLImageMixin(models.Model):
|
|||
def image_tag(self):
|
||||
"""Admin preview tag."""
|
||||
if self.image:
|
||||
return mark_safe(f'<img src="{self.image.url}" style="height: 25%; width: 25%" />')
|
||||
return mark_safe(f'<img src="{self.image.url}" style="max-height: 25%; max-width: 25%" />')
|
||||
else:
|
||||
return None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user