diff --git a/django_lostplaces/lostplaces/admin.py b/django_lostplaces/lostplaces/admin.py index d56db16..977bc23 100644 --- a/django_lostplaces/lostplaces/admin.py +++ b/django_lostplaces/lostplaces/admin.py @@ -17,6 +17,11 @@ class VoucherAdmin(admin.ModelAdmin): readonly_fields = ['created_when'] list_display = ('__str__', 'code', 'created_when', 'expires_when', 'valid') + def valid(self, instance): + return timezone.now() <= instance.expires_when + + valid.boolean = True + class PhotoAlbumsAdmin(admin.ModelAdmin): list_display = ('label', 'place', 'url' )