summaryrefslogtreecommitdiff
path: root/archaeological_finds/migrations/0033_auto_20180813_1310.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/migrations/0033_auto_20180813_1310.py')
-rw-r--r--archaeological_finds/migrations/0033_auto_20180813_1310.py87
1 files changed, 0 insertions, 87 deletions
diff --git a/archaeological_finds/migrations/0033_auto_20180813_1310.py b/archaeological_finds/migrations/0033_auto_20180813_1310.py
deleted file mode 100644
index caa840c06..000000000
--- a/archaeological_finds/migrations/0033_auto_20180813_1310.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.10 on 2018-08-13 13:10
-from __future__ import unicode_literals
-
-import django.core.validators
-from django.db import migrations, models
-import django.db.models.deletion
-import ishtar_common.models
-import re
-
-
-def migrate_finds(apps, schema_editor):
- Find = apps.get_model('archaeological_finds', 'Find')
- CheckedType = apps.get_model('archaeological_finds',
- 'CheckedType')
-
- not_checked, c = CheckedType.objects.get_or_create(
- txt_idx=u"not-checked",
- defaults={
- "label": u"Non vérifié",
- "order": 10
- }
- )
- checked_not_correct, c = CheckedType.objects.get_or_create(
- txt_idx=u"checked-not-correct",
- defaults={
- "label": u"Vérifié mais incorrect",
- "order": 20
- }
- )
- checked_correct, c = CheckedType.objects.get_or_create(
- txt_idx=u"checked-correct",
- defaults={
- "label": u"Vérifié et correct",
- "order": 30
- }
- )
- CHECK_CHOICES = {
- 'NC': not_checked,
- 'CI': checked_not_correct,
- 'CC': checked_correct,
- }
-
- for f in Find.objects.all():
- if not f.checked:
- continue
- f.checked_type = CHECK_CHOICES[f.checked]
- f.skip_history_when_saving = True
- f.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('archaeological_finds', '0032_auto_20180619_0911'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='CheckedType',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('label', models.TextField(verbose_name='Label')),
- ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')),
- ('comment', models.TextField(blank=True, null=True, verbose_name='Comment')),
- ('available', models.BooleanField(default=True, verbose_name='Available')),
- ('order', models.IntegerField(default=10, verbose_name='Order')),
- ],
- options={
- 'ordering': ('order',),
- 'verbose_name': 'Checked type',
- 'verbose_name_plural': 'Checked types',
- },
- bases=(ishtar_common.models.Cached, models.Model),
- ),
- migrations.AddField(
- model_name='find',
- name='checked_type',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='archaeological_finds.CheckedType', verbose_name='Check'),
- ),
- migrations.AddField(
- model_name='historicalfind',
- name='checked_type',
- field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_finds.CheckedType'),
- ),
- migrations.RunPython(migrate_finds),
- ]