diff --git a/bikeshop_project/registration/admin.py b/bikeshop_project/registration/admin.py index 571fe1f..6fa3094 100644 --- a/bikeshop_project/registration/admin.py +++ b/bikeshop_project/registration/admin.py @@ -33,6 +33,6 @@ class CustomUserAdmin(UserAdmin): @admin.register(Member) class MemberAdmin(admin.ModelAdmin): - list_display = ('get_full_name',) - ordering = ('last_name',) - search_fields = ('email', 'first_name', 'last_name') + list_display = ('get_full_name', 'created_at',) + ordering = ('last_name', ) + search_fields = ('email', 'first_name', 'last_name', 'created_at') diff --git a/bikeshop_project/registration/migrations/0004_auto_20170518_0332.py b/bikeshop_project/registration/migrations/0004_auto_20170518_0332.py new file mode 100644 index 0000000..f58b576 --- /dev/null +++ b/bikeshop_project/registration/migrations/0004_auto_20170518_0332.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.4 on 2017-05-18 03:32 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('registration', '0003_auto_20170215_0308'), + ] + + operations = [ + migrations.AddField( + model_name='member', + name='created_at', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='member', + name='modified_at', + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/bikeshop_project/registration/models.py b/bikeshop_project/registration/models.py index b301876..0a42612 100644 --- a/bikeshop_project/registration/models.py +++ b/bikeshop_project/registration/models.py @@ -96,6 +96,8 @@ class Member(models.Model): notes = models.TextField(null=True, blank=True) suspended = models.BooleanField(default=False) banned = models.BooleanField(default=False) + created_at = models.DateTimeField(auto_now_add=True) + modified_at = models.DateTimeField(auto_now=True) def get_full_name(self): # The user is identified by their email address