diff options
| author | fschildt <florian.schildt@protonmail.com> | 2025-10-17 14:00:16 +0200 | 
|---|---|---|
| committer | fschildt <florian.schildt@protonmail.com> | 2025-10-17 14:00:16 +0200 | 
| commit | d1e59579ca19454369d56a8c7525e109a86841e2 (patch) | |
| tree | 695f348acca3a32c97512685384da818a3ba5195 /apps/cultivation | |
first commit
Diffstat (limited to 'apps/cultivation')
| -rw-r--r-- | apps/cultivation/__init__.py | 0 | ||||
| -rw-r--r-- | apps/cultivation/admin.py | 3 | ||||
| -rw-r--r-- | apps/cultivation/apps.py | 6 | ||||
| -rw-r--r-- | apps/cultivation/migrations/__init__.py | 0 | ||||
| -rw-r--r-- | apps/cultivation/models.py | 114 | ||||
| -rw-r--r-- | apps/cultivation/templates/cultivation/index.html | 7 | ||||
| -rw-r--r-- | apps/cultivation/tests.py | 3 | ||||
| -rw-r--r-- | apps/cultivation/urls.py | 12 | ||||
| -rw-r--r-- | apps/cultivation/views.py | 17 | 
9 files changed, 162 insertions, 0 deletions
diff --git a/apps/cultivation/__init__.py b/apps/cultivation/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/cultivation/__init__.py diff --git a/apps/cultivation/admin.py b/apps/cultivation/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/cultivation/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/cultivation/apps.py b/apps/cultivation/apps.py new file mode 100644 index 0000000..1a320db --- /dev/null +++ b/apps/cultivation/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class CultivationConfig(AppConfig): +    default_auto_field = 'django.db.models.BigAutoField' +    name = 'apps.cultivation' diff --git a/apps/cultivation/migrations/__init__.py b/apps/cultivation/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/cultivation/migrations/__init__.py diff --git a/apps/cultivation/models.py b/apps/cultivation/models.py new file mode 100644 index 0000000..d28cc79 --- /dev/null +++ b/apps/cultivation/models.py @@ -0,0 +1,114 @@ +from django.db import models +from django.contrib.auth.models import User + + + +class MindSubject(models.Model): +    name = models.CharField(max_length=32, unique=True) + +    class Meta: +        db_table = "mind_subjects" + +    def __str__(self): +        return f"{self.name}" + + +class MindMaterial(models.Model): +    subject = models.ForeignKey(MindSubject, on_delete=models.CASCADE) +    material = models.CharField(max_length=32, unique=True) + +    class Meta: +        db_table = "mind_materials" + +    def __str__(self): +        return f"{self.subject},{self.material}" + + +class MindEvent(models.Model): +    date = models.DateField() +    user = models.ForeignKey(User, on_delete=models.CASCADE) +    material = models.ForeignKey(MindMaterial, on_delete=models.CASCADE) +    duration = models.DurationField() + +    class Meta: +        db_table = "mind_events" + +    def __str__(self): +        return f"{self.date},{self.user},{self.material},{self.duration}" + + + +class CardioExercise(models.Model): +    name = models.CharField(max_length=32) + +    class Meta: +        db_table = "cardio_exercises" + +    def __str__(self): +        return f"{self.name}" + + +class CardioEvent(models.Model): +    date = models.DateField() +    user = models.ForeignKey(User, on_delete=models.CASCADE) +    exercise = models.ForeignKey(CardioExercise, on_delete=models.CASCADE) +    duration = models.DurationField() +    distance = models.DecimalField(max_digits=3, decimal_places=3) + +    class Meta: +        db_table = "cardio_events" + +    def __str__(self): +        return f"{self.date},{self.user},{self.exercise},{self.duration},{self.distance}" + + + +class StrengthExercise(models.Model): +    name = models.CharField(max_length=32) + +    class Meta: +        db_table = "strength_exercises" + +    def __str__(self): +        return f"{self.name}" + + +class StrengthEvent(models.Model): +    date = models.DateField() +    user = models.ForeignKey(User, on_delete=models.CASCADE) +    exercise = models.ForeignKey(StrengthExercise, on_delete=models.CASCADE) +    weight = models.DecimalField(max_digits=3, decimal_places=3) +    reps = models.SmallIntegerField() + +    class Meta: +        db_table = "strength_events" + +    def __str__(self): +        return f"{self.date},{self.user},{self.exercise},{self.weight},{self.reps}" + + + +class FlexibilityExercise(models.Model): +    name = models.CharField(max_length=32) + +    class Meta: +        db_table = "flexibility_exercises" + +    def __str__(self): +        return f"{self.name}" + + +class FlexibilityEvent(models.Model): +    date = models.DateField() +    user = models.ForeignKey(User, on_delete=models.CASCADE) +    exercise = models.ForeignKey(FlexibilityExercise, on_delete=models.CASCADE) +    duration = models.DurationField() + +    class Meta: +        db_table = "flexibility_events" + +    def __str__(self): +        return f"{self.date},{self.user},{self.exercise},{self.duration}" + + + diff --git a/apps/cultivation/templates/cultivation/index.html b/apps/cultivation/templates/cultivation/index.html new file mode 100644 index 0000000..2d51317 --- /dev/null +++ b/apps/cultivation/templates/cultivation/index.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block title %}Cultivation - fsweb{% endblock %} + +{% block content %} + +{% endblock %} diff --git a/apps/cultivation/tests.py b/apps/cultivation/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/cultivation/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/cultivation/urls.py b/apps/cultivation/urls.py new file mode 100644 index 0000000..f56b4cf --- /dev/null +++ b/apps/cultivation/urls.py @@ -0,0 +1,12 @@ +from django.urls import path + +from . import views + +app_name = 'cultivation' +urlpatterns = [ +    path("", views.view_index, name="index"), +    path("cardio", views.view_cardio, name="cardio"), +    path("strength", views.view_strength, name="strength"), +    path("flexibility", views.view_flexibility, name="flexibility"), +    path("mind", views.view_mind, name="mind"), +] diff --git a/apps/cultivation/views.py b/apps/cultivation/views.py new file mode 100644 index 0000000..6db6307 --- /dev/null +++ b/apps/cultivation/views.py @@ -0,0 +1,17 @@ +from django.shortcuts import render + +def view_index(request): +    return render(request, 'cultivation/index.html', {'form': None}) + +def view_cardio(request): +    return render(request, 'cultivation/index.html', {'form': None}) + +def view_strength(request): +    return render(request, 'cultivation/index.html', {'form': None}) + +def view_flexibility(request): +    return render(request, 'cultivation/index.html', {'form': None}) + +def view_mind(request): +    return render(request, 'cultivation/index.html', {'form': None}) +  | 
