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:
parent
6dec37d3b9
commit
0911826501
14 changed files with 110 additions and 194 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue