...
 
Commits (4)
......@@ -14,6 +14,9 @@ class AccountAdmin(admin.ModelAdmin):
def get_username(self, obj):
return obj.user.username
def has_paid_membership(self, obj):
return obj.has_paid_membership
get_first_name.admin_order_field = 'user__first_name'
get_first_name.short_description = 'First name'
......@@ -23,7 +26,13 @@ class AccountAdmin(admin.ModelAdmin):
get_username.admin_order_field = 'user__username'
get_username.short_description = 'Username'
list_display = ('get_first_name', 'get_last_name', 'get_username')
has_paid_membership.admin_order_field = 'account__has_paid_membership'
has_paid_membership.short_description = 'Has paid the membership fee?'
list_display = ('get_first_name', 'get_last_name', 'get_username', 'has_paid_membership')
# Allow the 'has_paid_membership' flag to be directly edited in the admin table
list_editable = ('has_paid_membership',)
admin.site.register(PendingUser)
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-09-20 11:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0006_auto_20170325_1024'),
]
operations = [
migrations.AddField(
model_name='account',
name='has_paid_membership',
field=models.BooleanField(default=False),
),
]
......@@ -72,8 +72,11 @@ class Account(models.Model):
verbose_name='default_user',
on_delete=models.CASCADE,
)
cleaning = models.BooleanField(default=True)
has_paid_membership = models.BooleanField(default=False)
def __str__(self):
return '{} {} ({})'.format(
self.user.first_name,
......