diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index cd6f855..e20332c 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b..6055c0d 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index 8c38f3f..46eb905 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,6 @@ from django.contrib import admin +from .models import MoodEntry, Activity, Mission -# Register your models here. +admin.site.register(MoodEntry) +admin.site.register(Activity) +admin.site.register(Mission) \ No newline at end of file diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..47d803a --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,49 @@ +# Generated by Django 5.2.7 on 2025-12-22 18:33 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Activity', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('icon', models.CharField(max_length=50)), + ('category', models.CharField(choices=[('Social', 'Social'), ('Health', 'Health'), ('Hobbies', 'Hobbies'), ('Obligation', 'Obligation')], max_length=50)), + ], + ), + migrations.CreateModel( + name='Mission', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255)), + ('description', models.TextField()), + ('trigger_mood_score', models.IntegerField()), + ('is_active', models.BooleanField(default=True)), + ], + ), + migrations.CreateModel( + name='MoodEntry', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date_time', models.DateTimeField(auto_now_add=True)), + ('mood_score', models.IntegerField()), + ('note', models.TextField(blank=True, null=True)), + ('color_code', models.CharField(max_length=7)), + ('activities', models.ManyToManyField(to='core.activity')), + ('mission', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.mission')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..0eeb037 Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..16f0a31 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,38 @@ from django.db import models +from django.contrib.auth.models import User -# Create your models here. + +class Activity(models.Model): + class Category(models.TextChoices): + SOCIAL = 'Social' + HEALTH = 'Health' + HOBBIES = 'Hobbies' + OBLIGATION = 'Obligation' + + name = models.CharField(max_length=255) + icon = models.CharField(max_length=50) + category = models.CharField(max_length=50, choices=Category.choices) + + def __str__(self): + return self.name + +class Mission(models.Model): + title = models.CharField(max_length=255) + description = models.TextField() + trigger_mood_score = models.IntegerField() + is_active = models.BooleanField(default=True) + + def __str__(self): + return self.title + +class MoodEntry(models.Model): + user = models.ForeignKey(User, on_delete=models.CASCADE) + date_time = models.DateTimeField(auto_now_add=True) + mood_score = models.IntegerField() + note = models.TextField(blank=True, null=True) + color_code = models.CharField(max_length=7) + activities = models.ManyToManyField(Activity) + mission = models.ForeignKey(Mission, on_delete=models.SET_NULL, null=True, blank=True) + + def __str__(self): + return f'{self.user.username} - {self.date_time.strftime("%Y-%m-%d")}' \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..98c16d8 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -19,6 +19,18 @@
+ {% block content %}{% endblock %}