Skip to content

Commit

Permalink
chore(back): set modifiers and types required for spot, shop and bars
Browse files Browse the repository at this point in the history
  • Loading branch information
Asiberus committed Dec 23, 2022
1 parent 5541426 commit 0c95a8d
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 12 deletions.
4 changes: 2 additions & 2 deletions back/api/serializers/bar/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


class BarSerializer(serializers.ModelSerializer):
modifiers = serializers.MultipleChoiceField(choices=Bar.Modifiers.choices, required=False)
types = serializers.MultipleChoiceField(choices=Bar.Types.choices, required=False)
modifiers = serializers.MultipleChoiceField(choices=Bar.Modifiers.choices)
types = serializers.MultipleChoiceField(choices=Bar.Types.choices)
price = serializers.IntegerField(min_value=1, max_value=3)

# Read only fields
Expand Down
4 changes: 2 additions & 2 deletions back/api/serializers/shop/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


class ShopSerializer(serializers.ModelSerializer):
modifiers = serializers.MultipleChoiceField(choices=Shop.Modifiers.choices, required=False)
types = serializers.MultipleChoiceField(choices=Shop.Types.choices, required=False)
modifiers = serializers.MultipleChoiceField(choices=Shop.Modifiers.choices)
types = serializers.MultipleChoiceField(choices=Shop.Types.choices)
price = serializers.IntegerField(min_value=1, max_value=3)

# Read only fields
Expand Down
4 changes: 2 additions & 2 deletions back/api/serializers/spot/spot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


class SpotSerializer(serializers.ModelSerializer):
modifiers = serializers.MultipleChoiceField(choices=Spot.Modifiers.choices, required=False)
types = serializers.MultipleChoiceField(choices=Spot.Types.choices, required=False)
modifiers = serializers.MultipleChoiceField(choices=Spot.Modifiers.choices)
types = serializers.MultipleChoiceField(choices=Spot.Types.choices)

# Read only fields
type = serializers.CharField(default='spot', read_only=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Generated by Django 4.1.2 on 2022-12-23 16:59

from django.db import migrations
import multiselectfield.db.fields


class Migration(migrations.Migration):

dependencies = [
('app', '0007_bar_price_shop_price'),
]

operations = [
migrations.AlterField(
model_name='bar',
name='modifiers',
field=multiselectfield.db.fields.MultiSelectField(choices=[('tobacco', 'Tobacco'), ('food', 'Food'), ('card', 'Card'), ('choice', 'Choice'), ('outdoor', 'Outdoor')], default='[]', max_length=100),
preserve_default=False,
),
migrations.AlterField(
model_name='bar',
name='types',
field=multiselectfield.db.fields.MultiSelectField(choices=[('regular', 'Regular'), ('snack', 'Snack'), ('cellar', 'Cellar'), ('rooftop', 'Rooftop')], default='[]', max_length=100),
preserve_default=False,
),
migrations.AlterField(
model_name='shop',
name='modifiers',
field=multiselectfield.db.fields.MultiSelectField(choices=[('bio', 'Bio'), ('craft', 'Craft'), ('fresh', 'Fresh'), ('card', 'Card'), ('choice', 'Choice')], default='[]', max_length=100),
preserve_default=False,
),
migrations.AlterField(
model_name='shop',
name='types',
field=multiselectfield.db.fields.MultiSelectField(choices=[('store', 'Store'), ('super', 'Super'), ('hyper', 'Hyper'), ('cellar', 'Cellar')], default='[]', max_length=100),
preserve_default=False,
),
migrations.AlterField(
model_name='spot',
name='modifiers',
field=multiselectfield.db.fields.MultiSelectField(choices=[('bench', 'Bench'), ('covered', 'Covered'), ('toilet', 'Toilet'), ('store', 'Store'), ('trash', 'Trash'), ('parking', 'Parking')], default='[]', max_length=100),
preserve_default=False,
),
migrations.AlterField(
model_name='spot',
name='types',
field=multiselectfield.db.fields.MultiSelectField(choices=[('forest', 'Forest'), ('river', 'River'), ('mountain', 'Mountain'), ('beach', 'Beach'), ('city', 'City'), ('pov', 'Pov')], default='[]', max_length=100),
preserve_default=False,
),
]
4 changes: 2 additions & 2 deletions back/app/models/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Types(models.TextChoices):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_default_user), related_name='bar',
editable=False)
# Set max_length because max_length calcul is broken https://github.com/goinnn/django-multiselectfield/issues/131
modifiers = MultiSelectField(choices=Modifiers.choices, max_length=100, null=True, blank=True)
modifiers = MultiSelectField(choices=Modifiers.choices, max_length=100)
# Set max_length because max_length calcul is broken https://github.com/goinnn/django-multiselectfield/issues/131
types = MultiSelectField(choices=Types.choices, max_length=100, null=True, blank=True)
types = MultiSelectField(choices=Types.choices, max_length=100)
price = models.PositiveIntegerField()
4 changes: 2 additions & 2 deletions back/app/models/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Types(models.TextChoices):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_default_user), related_name='shops',
editable=False)
# Set max_length because max_length calcul is broken https://github.com/goinnn/django-multiselectfield/issues/131
modifiers = MultiSelectField(choices=Modifiers.choices, max_length=100, null=True, blank=True)
modifiers = MultiSelectField(choices=Modifiers.choices, max_length=100)
# Set max_length because max_length calcul is broken https://github.com/goinnn/django-multiselectfield/issues/131
types = MultiSelectField(choices=Types.choices, max_length=100, null=True, blank=True)
types = MultiSelectField(choices=Types.choices, max_length=100)
price = models.PositiveIntegerField()
4 changes: 2 additions & 2 deletions back/app/models/spot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ class Types(models.TextChoices):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_default_user), related_name='spots',
editable=False)
# Set max_length because max_length calcul is broken https://github.com/goinnn/django-multiselectfield/issues/131
modifiers = MultiSelectField(choices=Modifiers.choices, max_length=100, null=True, blank=True)
modifiers = MultiSelectField(choices=Modifiers.choices, max_length=100)
# Set max_length because max_length calcul is broken https://github.com/goinnn/django-multiselectfield/issues/131
types = MultiSelectField(choices=Types.choices, max_length=100, null=True, blank=True)
types = MultiSelectField(choices=Types.choices, max_length=100)

0 comments on commit 0c95a8d

Please sign in to comment.