From e973100f9076fe208fa9eb5f8e18c547235bce8a Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Sat, 14 Jan 2017 14:25:50 -0800 Subject: [PATCH 1/3] improve townie admin display --- ttadmin/users/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ttadmin/users/admin.py b/ttadmin/users/admin.py index 186f127..3212471 100644 --- a/ttadmin/users/admin.py +++ b/ttadmin/users/admin.py @@ -13,4 +13,5 @@ class PubkeyInline(admin.TabularInline): @admin.register(Townie) class TownieAdmin(admin.ModelAdmin): inlines = [PubkeyInline] - pass + list_display = ('reviewed', 'username', 'email') + ordering = ('reviewed',) From 8b20f0764de794c02dcd1fa486555653a8641cfc Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Mon, 16 Jan 2017 22:10:46 -0800 Subject: [PATCH 2/3] fix typo --- ttadmin/users/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttadmin/users/forms.py b/ttadmin/users/forms.py index 5fd11af..e5ea57b 100644 --- a/ttadmin/users/forms.py +++ b/ttadmin/users/forms.py @@ -22,7 +22,7 @@ def validate_username(username): if len(username) < USERNAME_MIN_LENGTH: raise ValidationError('Username too short.') if not USERNAME_RE.match(username): - raise ValidationError('Username must be all lowercase, start with a letter, and only use the _ special charcter') + raise ValidationError('Username must be all lowercase, start with a letter, and only use the _ special character') duplicate = Townie.objects.filter(username=username).count() if duplicate > 0: raise ValidationError('Username already in use :(') From 6d38a4190fcae07a419605016de92a5faf311179 Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Mon, 16 Jan 2017 22:10:55 -0800 Subject: [PATCH 3/3] handle default displayname --- ttadmin/users/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ttadmin/users/views.py b/ttadmin/users/views.py index 49aa79a..4f4b5f4 100644 --- a/ttadmin/users/views.py +++ b/ttadmin/users/views.py @@ -23,6 +23,8 @@ class SignupView(FormView): key_type=form.cleaned_data.pop('pubkey_type')) t = Townie(**form.cleaned_data) + if not getattr(t, 'displayname'): + t.displayname = t.username t.set_unusable_password() t.save() pubkey.townie = t