diff --git a/tests/migrations/0001_initial.py b/tests/migrations/0001_initial.py new file mode 100644 index 0000000..3d7a0f7 --- /dev/null +++ b/tests/migrations/0001_initial.py @@ -0,0 +1,60 @@ +# Generated by Django 5.0.4 on 2024-04-09 06:18 + +from django.db import migrations, models + +import enumfields.fields +import tests.enums + + +class Migration(migrations.Migration): + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="MyModel", + fields=[ + ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("color", enumfields.fields.EnumField(enum=tests.enums.Color, max_length=1)), + ( + "color_not_editable", + enumfields.fields.EnumField(editable=False, enum=tests.enums.Color, max_length=1, null=True), + ), + ("taste", enumfields.fields.EnumField(default=1, enum=tests.enums.Taste, max_length=10)), + ( + "taste_not_editable", + enumfields.fields.EnumField(default=1, editable=False, enum=tests.enums.Taste, max_length=10), + ), + ( + "taste_null_default", + enumfields.fields.EnumField( + blank=True, default=None, enum=tests.enums.Taste, max_length=10, null=True + ), + ), + ("taste_int", enumfields.fields.EnumIntegerField(default=1, enum=tests.enums.Taste)), + ( + "default_none", + enumfields.fields.EnumIntegerField(blank=True, default=None, enum=tests.enums.Taste, null=True), + ), + ("nullable", enumfields.fields.EnumIntegerField(blank=True, enum=tests.enums.Taste, null=True)), + ("random_code", models.TextField(blank=True, null=True)), + ("zero", enumfields.fields.EnumIntegerField(default=0, enum=tests.enums.ZeroEnum)), + ("zero2", enumfields.fields.EnumIntegerField(blank=True, default=0, enum=tests.enums.ZeroEnum)), + ( + "int_enum", + enumfields.fields.EnumIntegerField( + blank=True, default=None, enum=tests.enums.IntegerEnum, null=True + ), + ), + ( + "int_enum_not_editable", + enumfields.fields.EnumIntegerField(default=0, editable=False, enum=tests.enums.IntegerEnum), + ), + ( + "labeled_enum", + enumfields.fields.EnumField(blank=True, enum=tests.enums.LabeledEnum, max_length=10, null=True), + ), + ], + ), + ] diff --git a/tests/migrations/__init__.py b/tests/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/settings.py b/tests/settings.py index e6222a1..227a52c 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -5,6 +5,7 @@ 'django.contrib.sessions', 'django.contrib.auth', 'django.contrib.admin', + 'django.contrib.messages', 'tests', ) @@ -42,9 +43,12 @@ 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', + 'django.template.context_processors.request', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', ], }, }, ] + +DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'