diff options
author | 2018-10-27 17:27:11 +0100 | |
---|---|---|
committer | 2018-10-27 17:27:11 +0100 | |
commit | d3268527642df788531e3cd07a3e293b6d4affc7 (patch) | |
tree | 75da35d82e7514f8dd1df26364c478a7ccc57de7 /api | |
parent | Merge branch 'special_snakes' of https://gitlab.com/python-discord/projects/s... (diff) |
Changed image urlfield to ArrayField
Diffstat (limited to 'api')
-rw-r--r-- | api/migrations/0015_auto_20181027_1617.py | 19 | ||||
-rw-r--r-- | api/migrations/0016_auto_20181027_1619.py | 18 | ||||
-rw-r--r-- | api/models.py | 4 | ||||
-rw-r--r-- | api/serializers.py | 2 |
4 files changed, 41 insertions, 2 deletions
diff --git a/api/migrations/0015_auto_20181027_1617.py b/api/migrations/0015_auto_20181027_1617.py new file mode 100644 index 00000000..8973ff6d --- /dev/null +++ b/api/migrations/0015_auto_20181027_1617.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.2 on 2018-10-27 16:17 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0014_auto_20181025_1959'), + ] + + operations = [ + migrations.AlterField( + model_name='specialsnake', + name='image', + field=django.contrib.postgres.fields.ArrayField(base_field=models.URLField(), size=None), + ), + ] diff --git a/api/migrations/0016_auto_20181027_1619.py b/api/migrations/0016_auto_20181027_1619.py new file mode 100644 index 00000000..b8bdfb16 --- /dev/null +++ b/api/migrations/0016_auto_20181027_1619.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.2 on 2018-10-27 16:19 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0015_auto_20181027_1617'), + ] + + operations = [ + migrations.RenameField( + model_name='specialsnake', + old_name='image', + new_name='images', + ), + ] diff --git a/api/models.py b/api/models.py index eb9c2e16..bc778330 100644 --- a/api/models.py +++ b/api/models.py @@ -114,7 +114,9 @@ class SpecialSnake(ModelReprMixin, models.Model): info = models.TextField( help_text='Info about a special snake.' ) - image = models.URLField() + images = pgfields.ArrayField( + models.URLField() + ) def __str__(self): return self.name diff --git a/api/serializers.py b/api/serializers.py index 3a379771..f8d15bbf 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -46,7 +46,7 @@ class SnakeNameSerializer(ModelSerializer): class SpecialSnakeSerializer(ModelSerializer): class Meta: model = SpecialSnake - fields = ('name', 'image', 'info') + fields = ('name', 'images', 'info') class RoleSerializer(ModelSerializer): |