1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-11-20 10:27
from __future__ import unicode_literals
from django.db import migrations, models
def init_create_new_find(apps, schema):
TreatmentType = apps.get_model('archaeological_finds', 'TreatmentType')
for tp in TreatmentType.objects.all():
if (tp.upstream_is_many or tp.downstream_is_many) and not tp.virtual:
tp.create_new_find = True
tp.save()
class Migration(migrations.Migration):
dependencies = [
('archaeological_finds', '0039_auto_20181115_1649'),
]
operations = [
migrations.AlterModelOptions(
name='treatment',
options={'ordering': ('start_date',), 'permissions': (('view_treatment', 'Can view all Treatments'), ('view_own_treatment', 'Can view own Treatment'), ('add_own_treatment', 'Can add own Treatment'), ('change_own_treatment', 'Can change own Treatment'), ('delete_own_treatment', 'Can delete own Treatment')), 'verbose_name': 'Treatment', 'verbose_name_plural': 'Treatments'},
),
migrations.AddField(
model_name='treatmenttype',
name='create_new_find',
field=models.BooleanField(default=False, help_text='If True when this treatment is applied a new version of the object will be created.', verbose_name='Create a new find'),
),
migrations.RunPython(init_create_new_find)
]
|