From 58ab70ba42e13856d9af47a521fd19c1d331ea9e Mon Sep 17 00:00:00 2001 From: Leonhard Strohmidel Date: Fri, 1 Oct 2021 09:40:42 +0200 Subject: [PATCH] #42 Levels for places --- .../lostplaces/migrations/0009_place_level.py | 18 ++++++++++++++++++ django_lostplaces/lostplaces/models/place.py | 12 ++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 django_lostplaces/lostplaces/migrations/0009_place_level.py diff --git a/django_lostplaces/lostplaces/migrations/0009_place_level.py b/django_lostplaces/lostplaces/migrations/0009_place_level.py new file mode 100644 index 0000000..eeee176 --- /dev/null +++ b/django_lostplaces/lostplaces/migrations/0009_place_level.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.1 on 2021-10-01 07:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('lostplaces', '0008_explorer_level'), + ] + + operations = [ + migrations.AddField( + model_name='place', + name='level', + field=models.IntegerField(choices=[(1, 'Ruin'), (2, 'Vandalized'), (3, 'Natures Treasure'), (4, 'Long Time no See'), (5, 'Time Capsule')], default=5), + ), + ] diff --git a/django_lostplaces/lostplaces/models/place.py b/django_lostplaces/lostplaces/models/place.py index b6f130e..acfcda7 100644 --- a/django_lostplaces/lostplaces/models/place.py +++ b/django_lostplaces/lostplaces/models/place.py @@ -11,6 +11,13 @@ from lostplaces.models.abstract_models import Submittable, Taggable, Mapable from easy_thumbnails.fields import ThumbnailerImageField from easy_thumbnails.files import get_thumbnailer +PLACE_LEVELS = ( + (1, 'Ruin'), + (2, 'Vandalized'), + (3, 'Natures Treasure'), + (4, 'Long Time no See'), + (5, 'Time Capsule') +) class Place(Submittable, Taggable, Mapable): """ @@ -34,6 +41,11 @@ class Place(Submittable, Taggable, Mapable): related_name='place_heros' ) + level = models.IntegerField( + default=5, + choices=PLACE_LEVELS + ) + def get_hero_image(self): if self.hero: return self.hero