Show new fields in admin

parent 00643ee5
......@@ -38,13 +38,16 @@ class RegistrationAdmin(admin.ModelAdmin):
'length',
'membership_type',
'status',
'remarks',)
'payment',
'remarks')
}),
(_('Personal information'), {
'fields': ('first_name',
'last_name',
'birthday',
'optin_birthday',
'email',
'optin_mailinglist',
'phone_number',)
}),
(_('Address'), {
......@@ -90,7 +93,7 @@ class RegistrationAdmin(admin.ModelAdmin):
def get_readonly_fields(self, request, obj=None):
if obj is None or not (obj.status == Entry.STATUS_REJECTED or
obj.status == Entry.STATUS_ACCEPTED):
return ['status', 'created_at', 'updated_at']
return ['status', 'created_at', 'updated_at', 'payment']
else:
return [field.name for field in self.model._meta.get_fields()
if field.editable]
......
......@@ -145,12 +145,14 @@ class RegistrationAdminTest(TestCase):
request = _get_mock_request([])
fields = self.admin.get_readonly_fields(request)
self.assertEqual(fields, ['status', 'created_at', 'updated_at'])
self.assertEqual(fields, ['status', 'created_at',
'updated_at', 'payment'])
fields = self.admin.get_readonly_fields(request, Registration(
status=Entry.STATUS_CONFIRM
))
self.assertEqual(fields, ['status', 'created_at', 'updated_at'])
self.assertEqual(fields, ['status', 'created_at',
'updated_at', 'payment'])
fields = self.admin.get_readonly_fields(request, Registration(
status=Entry.STATUS_REJECTED
......@@ -282,13 +284,14 @@ class RenewalAdminTest(TestCase):
request = _get_mock_request([])
fields = self.admin.get_readonly_fields(request)
self.assertEqual(fields, ['status', 'created_at', 'updated_at'])
self.assertEqual(fields, ['status', 'created_at',
'updated_at', 'payment'])
fields = self.admin.get_readonly_fields(request, Renewal(
status=Entry.STATUS_CONFIRM
))
self.assertEqual(fields, ['status', 'created_at',
'updated_at', 'member'])
'updated_at', 'payment', 'member'])
fields = self.admin.get_readonly_fields(request, Renewal(
status=Entry.STATUS_REJECTED
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment