From ac2981ffc66a049919bdac16a65055badc75ec75 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Sat, 1 Aug 2020 13:31:52 +0200 Subject: [PATCH] Added voucher creation date display in voucher edit view. --- lostplaces/lostplaces_app/admin.py | 6 +++++- lostplaces/lostplaces_app/models.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lostplaces/lostplaces_app/admin.py b/lostplaces/lostplaces_app/admin.py index 6016d15..4060f1a 100644 --- a/lostplaces/lostplaces_app/admin.py +++ b/lostplaces/lostplaces_app/admin.py @@ -18,7 +18,11 @@ class ExplorerAdmin(UserAdmin): model = Explorer list_display = ['email', 'username',] +class VoucherAdmin(admin.ModelAdmin): + fields = ['code', 'expires', 'created'] + readonly_fields = ['created'] + admin.site.register(Explorer, ExplorerAdmin) -admin.site.register(Voucher) +admin.site.register(Voucher, VoucherAdmin) admin.site.register(Place) admin.site.register(PlaceImage) diff --git a/lostplaces/lostplaces_app/models.py b/lostplaces/lostplaces_app/models.py index 3be9545..a52f252 100644 --- a/lostplaces/lostplaces_app/models.py +++ b/lostplaces/lostplaces_app/models.py @@ -26,7 +26,7 @@ class Voucher(models.Model): """ Vouchers are authorization tokens to allow the registration of new users. A voucher has a code, a creation and a deletion date, which are all positional. - Creation date is being set automatically during voucher creation. + Creation date is being set automatically during voucher creation. """ code = models.CharField(unique=True, max_length=10)