add category field, and add unique_together constraint to TokenFind model until I figure out why it is creating duplicates

This commit is contained in:
Thomas Steen Rasmussen 2018-08-19 17:56:04 +02:00
parent 97ba725ba2
commit df34d3edf3
3 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# Generated by Django 2.0.4 on 2018-08-19 15:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tokens', '0002_tokenfind'),
]
operations = [
migrations.AddField(
model_name='token',
name='category',
field=models.TextField(default='', help_text='The category/hint for this token (physical, website, whatever)'),
preserve_default=False,
),
]

View file

@ -0,0 +1,19 @@
# Generated by Django 2.0.4 on 2018-08-19 15:43
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('tokens', '0003_token_category'),
]
operations = [
migrations.AlterUniqueTogether(
name='tokenfind',
unique_together={('user', 'token')},
),
]

View file

@ -13,6 +13,10 @@ class Token(CampRelatedModel):
help_text="The secret token" help_text="The secret token"
) )
category = models.TextField(
help_text="The category/hint for this token (physical, website, whatever)"
)
description = models.TextField( description = models.TextField(
help_text="The description of the token" help_text="The description of the token"
) )
@ -24,6 +28,9 @@ class Token(CampRelatedModel):
class TokenFind(CampRelatedModel): class TokenFind(CampRelatedModel):
class Meta:
unique_together = (('user', 'token'))
token = models.ForeignKey( token = models.ForeignKey(
'tokens.Token', 'tokens.Token',
on_delete=models.PROTECT on_delete=models.PROTECT