Merge pull request #3 from nathanielksmith/master

small improvements
pull/16/head
Nathaniel Smith 2017-01-16 23:31:25 -08:00 committed by GitHub
commit 9996fbeb6a
3 changed files with 5 additions and 2 deletions

View File

@ -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',)

View File

@ -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 :(')

View File

@ -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