]> gitweb.fperrin.net Git - djsite.git/blobdiff - quotes/migrations/0001_initial.py
Better implement tags, with separate namespaces
[djsite.git] / quotes / migrations / 0001_initial.py
index 927cce952bf1bbc33259c6d499cb9e36288cfeff..970ae11b4a5eb22cfd7ca919d7cb1931999a5888 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Generated by Django 1.10.2 on 2016-10-31 00:22
+# Generated by Django 1.10.2 on 2016-10-31 23:03
 from __future__ import unicode_literals
 
 from django.db import migrations, models
@@ -19,13 +19,23 @@ class Migration(migrations.Migration):
             name='Author',
             fields=[
                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
-                ('name', models.CharField(help_text=b'Name of the author', max_length=100)),
+                ('name', models.CharField(help_text=b'Name of the author', max_length=100, unique=True)),
                 ('notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the author; may be left blank. Will                       not be HTML-escaped.')),
                 ('pvt_notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the author; not displayed on                           the public interface')),
                 ('birth_date', models.DateField(blank=True, help_text=b'Date of birth', null=True)),
                 ('death_date', models.DateField(blank=True, help_text=b'Date of death (leave blank                                   if still alive!)', null=True)),
             ],
         ),
+        migrations.CreateModel(
+            name='AuthorTag',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('tag', models.CharField(max_length=100, unique=True)),
+            ],
+            options={
+                'abstract': False,
+            },
+        ),
         migrations.CreateModel(
             name='Quote',
             fields=[
@@ -36,28 +46,45 @@ class Migration(migrations.Migration):
             ],
         ),
         migrations.CreateModel(
-            name='Tag',
+            name='QuoteTag',
             fields=[
                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
-                ('tag', models.CharField(max_length=100)),
+                ('tag', models.CharField(max_length=100, unique=True)),
             ],
+            options={
+                'abstract': False,
+            },
         ),
         migrations.CreateModel(
             name='Work',
             fields=[
                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
-                ('name', models.CharField(help_text=b'Name of the context for the quote                             (title of the work or speech it appears in)', max_length=100)),
+                ('name', models.CharField(help_text=b'Name of the context for the quote                             (title of the work or speech it appears in)', max_length=100, unique=True)),
                 ('date', models.DateField(blank=True, help_text=b'Date of the quote', null=True)),
                 ('notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the work; may be left blank. Will                       not be HTML-escaped. XXX: offer a WYSIWYG editor')),
                 ('pvt_notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the work; not displayed on                           the public interface')),
                 ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quotes.Author')),
-                ('tags', models.ManyToManyField(blank=True, to='quotes.Tag')),
             ],
         ),
+        migrations.CreateModel(
+            name='WorkTag',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('tag', models.CharField(max_length=100, unique=True)),
+            ],
+            options={
+                'abstract': False,
+            },
+        ),
+        migrations.AddField(
+            model_name='work',
+            name='tags',
+            field=models.ManyToManyField(blank=True, to='quotes.WorkTag'),
+        ),
         migrations.AddField(
             model_name='quote',
             name='tags',
-            field=models.ManyToManyField(blank=True, to='quotes.Tag'),
+            field=models.ManyToManyField(blank=True, to='quotes.QuoteTag'),
         ),
         migrations.AddField(
             model_name='quote',
@@ -67,6 +94,6 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='author',
             name='tags',
-            field=models.ManyToManyField(blank=True, to='quotes.Tag'),
+            field=models.ManyToManyField(blank=True, to='quotes.AuthorTag'),
         ),
     ]