mh1
This commit is contained in:
parent
cdfc6c0375
commit
05303880c9
Binary file not shown.
Binary file not shown.
@ -1,3 +1,6 @@
|
|||||||
from django.contrib import admin
|
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)
|
||||||
49
core/migrations/0001_initial.py
Normal file
49
core/migrations/0001_initial.py
Normal file
@ -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)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
Binary file not shown.
@ -1,3 +1,38 @@
|
|||||||
from django.db import models
|
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")}'
|
||||||
@ -19,6 +19,18 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="/">PixelMinds</a>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/admin">Admin</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user