1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-20 13:29:37 +02:00

Migrate to visits

This commit is contained in:
Sean Morley 2024-09-22 14:12:41 -04:00
parent 6dec37d3b9
commit 0911826501
14 changed files with 110 additions and 194 deletions

View file

@ -6,19 +6,9 @@ from worldtravel.models import Country, Region, VisitedRegion
class AdventureAdmin(admin.ModelAdmin):
list_display = ('name', 'type', 'user_id', 'is_public', 'image_display')
list_display = ('name', 'type', 'user_id', 'is_public')
list_filter = ('type', 'user_id', 'is_public')
def image_display(self, obj):
if obj.image:
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
public_url = public_url.replace("'", "")
return mark_safe(f'<img src="{public_url}/media/{obj.image.name}" width="100px" height="100px"')
else:
return
image_display.short_description = 'Image Preview'
class CountryAdmin(admin.ModelAdmin):
list_display = ('name', 'country_code', 'number_of_regions')