2020-08-25 13:24:46 -04:00
|
|
|
import django.contrib.postgres.fields
|
2020-10-15 15:06:01 -04:00
|
|
|
import django.core.validators
|
2020-08-25 13:24:46 -04:00
|
|
|
from django.db import migrations, models
|
2020-10-15 15:06:01 -04:00
|
|
|
|
|
|
|
import utilities.validators
|
2020-08-25 13:24:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
('extras', '0049_remove_graph'),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
# Rename reverse relation on CustomFieldChoice
|
|
|
|
migrations.AlterField(
|
|
|
|
model_name='customfieldchoice',
|
|
|
|
name='field',
|
|
|
|
field=models.ForeignKey(
|
|
|
|
limit_choices_to={'type': 'select'},
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
related_name='_choices',
|
|
|
|
to='extras.customfield'
|
|
|
|
),
|
|
|
|
),
|
|
|
|
# Add choices field to CustomField
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='customfield',
|
|
|
|
name='choices',
|
|
|
|
field=django.contrib.postgres.fields.ArrayField(
|
|
|
|
base_field=models.CharField(max_length=100),
|
|
|
|
blank=True,
|
|
|
|
null=True,
|
|
|
|
size=None
|
|
|
|
),
|
|
|
|
),
|
2020-12-01 16:05:23 -05:00
|
|
|
# Introduce new default field (to be renamed later)
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='customfield',
|
|
|
|
name='default2',
|
|
|
|
field=models.JSONField(blank=True, null=True),
|
|
|
|
),
|
2020-10-14 15:23:23 -04:00
|
|
|
# Rename obj_type to content_types
|
|
|
|
migrations.RenameField(
|
|
|
|
model_name='customfield',
|
|
|
|
old_name='obj_type',
|
|
|
|
new_name='content_types',
|
|
|
|
),
|
2020-10-15 15:06:01 -04:00
|
|
|
# Add validation fields
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='customfield',
|
|
|
|
name='validation_maximum',
|
|
|
|
field=models.PositiveIntegerField(blank=True, null=True),
|
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='customfield',
|
|
|
|
name='validation_minimum',
|
|
|
|
field=models.PositiveIntegerField(blank=True, null=True),
|
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='customfield',
|
|
|
|
name='validation_regex',
|
|
|
|
field=models.CharField(blank=True, max_length=500, validators=[utilities.validators.validate_regex]),
|
|
|
|
),
|
2020-08-25 13:24:46 -04:00
|
|
|
]
|