1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-05 05:05:17 +02:00

feat: Refactor hotel terminology to lodging and update related components

This commit is contained in:
Sean Morley 2025-02-08 16:10:01 -05:00
parent d2cb862103
commit 68924d7ecc
17 changed files with 510 additions and 135 deletions

View file

@ -0,0 +1,23 @@
# Generated by Django 5.0.8 on 2025-02-08 01:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('achievements', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='achievement',
name='key',
field=models.CharField(default='achievements.other', max_length=255, unique=True),
),
migrations.AddField(
model_name='achievement',
name='type',
field=models.CharField(choices=[('adventure_count', 'adventure_count'), ('country_count', 'country_count')], default='adventure_count', max_length=255),
),
]

View file

@ -1,3 +1,4 @@
import uuid
from django.db import models
from django.contrib.auth import get_user_model
@ -11,8 +12,8 @@ VALID_ACHIEVEMENT_TYPES = [
class Achievement(models.Model):
"""Stores all possible achievements"""
name = models.CharField(max_length=255, unique=True)
key = models.CharField(max_length=255, unique=True) # Used for frontend lookups, e.g. "achievements.first_adventure"
type = models.CharField(max_length=255) # adventure_count, country_count, etc.
key = models.CharField(max_length=255, unique=True, default='achievements.other') # Used for frontend lookups, e.g. "achievements.first_adventure"
type = models.CharField(max_length=255, choices=[(tag, tag) for tag in VALID_ACHIEVEMENT_TYPES], default='adventure_count') # adventure_count, country_count, etc.
description = models.TextField()
icon = models.ImageField(upload_to="achievements/", null=True, blank=True)
condition = models.JSONField() # Stores rules like {"type": "adventure_count", "value": 10}