Change OTPSeed to AbstractUser

This commit is contained in:
Nico Schottelius 2018-11-17 23:00:36 +01:00
parent a0d15ecf23
commit 2fb8c91415
5 changed files with 11 additions and 32 deletions

View File

@ -1,9 +1,14 @@
from django.contrib import admin
# Register your models here.
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import OTPSeed
admin.site.register(OTPSeed)
#admin.site.register(OTPSeed)
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
admin.site.register(OTPSeed, UserAdmin)

View File

@ -1,27 +0,0 @@
# Generated by Django 2.1.3 on 2018-11-17 09:01
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='OTPSeed',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=128)),
('realm', models.CharField(max_length=128)),
('seed', models.CharField(max_length=128)),
],
),
migrations.AlterUniqueTogether(
name='otpseed',
unique_together={('name', 'realm')},
),
]

View File

@ -2,7 +2,7 @@ from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class OTPSeed(models.Model):
class OTPSeed(AbstractUser):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=128)
realm = models.CharField(max_length=128)
@ -14,7 +14,6 @@ class OTPSeed(models.Model):
def __str__(self):
return "'{}'@{}".format(self.name, self.realm)
# class OTPUser(AbstractUser, OTPSeed):
# @classmethod
# def get_username(cls):
# pass

View File

@ -120,3 +120,5 @@ USE_TZ = True
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
AUTH_USER_MODEL = 'otpauth.OTPSeed'