2019-04-03 09:36:41 +13:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2019-05-01 15:44:51 +12:00
|
|
|
from core.models import Snapshot
|
2019-04-28 09:26:24 +12:00
|
|
|
|
2019-04-23 05:20:19 +12:00
|
|
|
|
2019-05-01 15:44:51 +12:00
|
|
|
class SnapshotAdmin(admin.ModelAdmin):
|
2019-04-23 05:20:19 +12:00
|
|
|
list_display = ('timestamp', 'short_url', 'title', 'is_archived', 'num_outputs', 'added', 'updated', 'url_hash')
|
2019-04-23 13:40:42 +12:00
|
|
|
readonly_fields = ('num_outputs', 'is_archived', 'added', 'updated', 'bookmarked')
|
|
|
|
fields = ('url', 'timestamp', 'title', 'tags', *readonly_fields)
|
2019-04-23 05:20:19 +12:00
|
|
|
|
|
|
|
def short_url(self, obj):
|
|
|
|
return obj.url[:64]
|
|
|
|
|
2019-04-23 13:40:42 +12:00
|
|
|
def updated(self, obj):
|
|
|
|
return obj.isoformat()
|
|
|
|
|
2019-05-01 15:44:51 +12:00
|
|
|
admin.site.register(Snapshot, SnapshotAdmin)
|