This commit is contained in:
Paul Konstantin Gerke 2022-03-05 13:01:59 +01:00
parent 7bbaee1f80
commit b27cf6c4b8
1 changed files with 81 additions and 19 deletions

View File

@ -10,40 +10,102 @@ import django.utils.timezone
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('contenttypes', '0002_remove_content_type_name'), ("contenttypes", "0002_remove_content_type_name"),
('core', '0018_bmi_headcircumference_height'), ("core", "0018_bmi_headcircumference_height"),
] ]
operations = [ operations = [
migrations.CreateModel( migrations.CreateModel(
name='Tag', name="Tag",
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), (
('name', models.CharField(max_length=100, unique=True, verbose_name='name')), "id",
('slug', models.SlugField(max_length=100, unique=True, verbose_name='slug')), models.AutoField(
('color', models.CharField(default=core.models.random_color, max_length=32, validators=[django.core.validators.RegexValidator('^#[0-9A-F]{6}$')], verbose_name='Color')), auto_created=True,
('last_used', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Last used')), primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(max_length=100, unique=True, verbose_name="name"),
),
(
"slug",
models.SlugField(max_length=100, unique=True, verbose_name="slug"),
),
(
"color",
models.CharField(
default=core.models.random_color,
max_length=32,
validators=[
django.core.validators.RegexValidator("^#[0-9A-F]{6}$")
],
verbose_name="Color",
),
),
(
"last_used",
models.DateTimeField(
default=django.utils.timezone.now, verbose_name="Last used"
),
),
], ],
options={ options={
'verbose_name': 'Tag', "verbose_name": "Tag",
'verbose_name_plural': 'Tags', "verbose_name_plural": "Tags",
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='Tagged', name="Tagged",
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), (
('object_id', models.IntegerField(db_index=True, verbose_name='object ID')), "id",
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_tagged_items', to='contenttypes.contenttype', verbose_name='content type')), models.AutoField(
('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_items', to='core.tag', verbose_name='Tag')), auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"object_id",
models.IntegerField(db_index=True, verbose_name="object ID"),
),
(
"content_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="%(app_label)s_%(class)s_tagged_items",
to="contenttypes.contenttype",
verbose_name="content type",
),
),
(
"tag",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="%(app_label)s_%(class)s_items",
to="core.tag",
verbose_name="Tag",
),
),
], ],
options={ options={
'abstract': False, "abstract": False,
}, },
), ),
migrations.AddField( migrations.AddField(
model_name='note', model_name="note",
name='tags', name="tags",
field=core.models.TaggableManager(blank=True, help_text=None, through='core.Tagged', to='core.Tag', verbose_name='Tags'), field=core.models.TaggableManager(
blank=True,
help_text=None,
through="core.Tagged",
to="core.Tag",
verbose_name="Tags",
),
), ),
] ]