Kumi
53429b9ded
This commit establishes the initial set of models required for the dream tracking feature within the application, including models for Dream, DreamMedia, Theme, DreamTheme, and ThemeRating, along with their associations. The structure allows for comprehensive tracking and categorization of user dreams, media associated with dreams, thematic elements, and ratings for these themes. This foundational work is critical for enabling detailed dream recording and analysis, supporting functionalities such as dream categorization, mood association, and user-specific customization. The relationships between models facilitate advanced queries for insights and trends in dream content, mood correlations, and thematic popularity. The choice of fields and types ensures a balance between flexibility for future enhancements and the current performance requirements.
82 lines
4.1 KiB
Python
82 lines
4.1 KiB
Python
# Generated by Django 5.0.6 on 2024-05-17 11:28
|
|
|
|
import colorfield.fields
|
|
import common.helpers
|
|
import django.core.validators
|
|
import django.db.models.deletion
|
|
import django.utils.timezone
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('mood', '0001_initial'),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Dream',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
|
|
('title', models.CharField(max_length=64)),
|
|
('content', models.TextField()),
|
|
('type', models.IntegerField(choices=[(0, 'Night (main) sleep'), (1, 'Daydream'), (2, 'Napping')])),
|
|
('lucid', models.BooleanField(default=False)),
|
|
('wet', models.BooleanField(default=False)),
|
|
('mood', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='mood.mood')),
|
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='DreamMedia',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('media', models.FileField(upload_to='', verbose_name=common.helpers.get_upload_path)),
|
|
('dream', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dreams.dream')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Theme',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=64)),
|
|
('icon', models.CharField(default='fas fa-bed', max_length=64)),
|
|
('color', colorfield.fields.ColorField(default='#000000', image_field=None, max_length=25, samples=None)),
|
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='DreamTheme',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('dream', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dreams.dream')),
|
|
('theme', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dreams.theme')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='ThemeRating',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=64)),
|
|
('icon', models.CharField(default='fas fa-star', max_length=64)),
|
|
('color', colorfield.fields.ColorField(default='#000000', image_field=None, max_length=25, samples=None)),
|
|
('value', models.IntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])),
|
|
('theme', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dreams.theme')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='DreamThemeRating',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('comment', models.TextField(blank=True, null=True)),
|
|
('dream', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dreams.dream')),
|
|
('theme_rating', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='dreams.themerating')),
|
|
],
|
|
),
|
|
]
|