#42 Level for Users
This commit is contained in:
parent
e52247d80b
commit
0852e35b57
@ -0,0 +1,44 @@
|
||||
# Generated by Django 3.1.1 on 2021-10-01 06:48
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import easy_thumbnails.fields
|
||||
import lostplaces.models.place
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lostplaces', '0006_merge_0004_release_0_1_3_0005_add_visited_places'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='explorer',
|
||||
name='favorite_places',
|
||||
field=models.ManyToManyField(blank=True, related_name='explorer_favorites', to='lostplaces.Place', verbose_name='Explorers favorite places'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='place',
|
||||
name='hero',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='place_heros', to='lostplaces.placeimage'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='placeimage',
|
||||
name='filename',
|
||||
field=easy_thumbnails.fields.ThumbnailerImageField(help_text='Optional: One or more images to upload', upload_to=lostplaces.models.place.generate_place_image_filename, verbose_name='Images'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DummyAsset',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('submitted_when', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Submission date')),
|
||||
('name', models.CharField(max_length=50)),
|
||||
('place', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dummyassets', to='lostplaces.place')),
|
||||
('submitted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dummyassets', to='lostplaces.explorer', verbose_name='Submitter')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.1 on 2021-10-01 06:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lostplaces', '0007_auto_20211001_0648'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='explorer',
|
||||
name='level',
|
||||
field=models.IntegerField(choices=[(1, 'Newbie'), (2, 'Scout'), (3, 'Explorer'), (4, 'Journalist'), (5, 'Housekeeper')], default=1),
|
||||
),
|
||||
]
|
@ -29,6 +29,14 @@ def generate_profile_image_filename(instance, filename):
|
||||
|
||||
return 'explorers/' + str(instance.user.pk) + '-' + str(instance.user.username) + '.' + filename.split('.')[-1]
|
||||
|
||||
EXPLORER_LEVELS = (
|
||||
(1, 'Newbie'),
|
||||
(2, 'Scout'),
|
||||
(3, 'Explorer'),
|
||||
(4, 'Journalist'),
|
||||
(5, 'Housekeeper')
|
||||
)
|
||||
|
||||
class Explorer(models.Model):
|
||||
"""
|
||||
Profile that is linked to the Django user.
|
||||
@ -69,6 +77,11 @@ class Explorer(models.Model):
|
||||
blank=True
|
||||
)
|
||||
|
||||
level = models.IntegerField(
|
||||
default=1,
|
||||
choices=EXPLORER_LEVELS
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user