commit
9996fbeb6a
|
@ -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',)
|
||||
|
|
|
@ -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 :(')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue