From a58886979f9f57485e98385520a5871d0d3f195e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 17 Nov 2018 09:42:34 +0100 Subject: [PATCH] Update the model to remove uuid, simplify --- ungleichotp/otpauth/models.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ungleichotp/otpauth/models.py b/ungleichotp/otpauth/models.py index bf58364..59c5fae 100644 --- a/ungleichotp/otpauth/models.py +++ b/ungleichotp/otpauth/models.py @@ -1,10 +1,19 @@ from django.db import models -import uuid # Create your models here. class OTPSeed(models.Model): - appuuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) - appname = models.CharField(max_length=128) - username = models.CharField(max_length=128) + name = models.CharField(max_length=128) + realm = models.CharField(max_length=128) seed = models.CharField(max_length=128) - trusted = models.BooleanField(default=False) + + class Meta: + unique_together = (('name', 'realm'),) + + +# V1 +# class OTPSeed(models.Model): +# appuuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) +# appname = models.CharField(max_length=128) +# username = models.CharField(max_length=128) +# seed = models.CharField(max_length=128) +# trusted = models.BooleanField(default=False)