--- /dev/null
+{% extends 'core/base.html' %}
+
+{% block content %}
+ {% for object in object_list %}
+ <p>{{ object.name }}</p>
+ {% if not forloop.last %}
+ <hr/>
+ {% endif %}
+ {% empty %}
+ <em>No areas found.</em>
+ {% endfor %}
+{% endblock %}
--- /dev/null
+from django.urls import path
+
+from . import views
+
+urlpatterns = (
+ path('', views.index),
+)
-from django.shortcuts import render
+from django.views.generic.list import ListView
-# Create your views here.
+from . import models
+
+class AreaListView(ListView):
+ model = models.Area
+
+index = AreaListView.as_view()
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
- 'core',
'climbing',
'nutrition',
'training',
+ 'core',
]
MIDDLEWARE = [
--- /dev/null
+<!doctype html>
+
+<html lang='en'>
+ <head>
+ <meta charset='utf-8'>
+ <meta name='viewport' content='width=device-width, initial-scale=1'>
+
+ <title>Climbing</title>
+ <meta name='author' content='David Kerkeslager'>
+ </head>
+
+ <body>
+ {% block content %}{% endblock %}
+ </body>
+</html>
-<!doctype html>
-
-<html lang='en'>
- <head>
- <meta charset='utf-8'>
- <meta name='viewport' content='width=device-width, initial-scale=1'>
-
- <title>Climbing</title>
- <meta name='author' content='David Kerkeslager'>
- </head>
-
- <body>
- Hello, world
- </body>
-</html>
+{% extends 'core/base.html' %}
+{% block content %}
+ Goodnight, moon
+{% endblock %}
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
-from django.urls import path
+from django.urls import include, path
+
+from climbing import urls as climbing_urls
+from nutrition import urls as nutrition_urls
+from training import urls as training_urls
from . import views
urlpatterns = (
path('admin/', admin.site.urls),
path('', views.index),
+ path('c/', include(climbing_urls)),
+ path('n/', include(nutrition_urls)),
+ path('t/', include(training_urls)),
)
--- /dev/null
+# Generated by Django 4.0.3 on 2022-03-03 16:03
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Food',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.TextField(max_length=64)),
+ ('brand', models.TextField(max_length=64)),
+ ('calories', models.PositiveIntegerField()),
+ ],
+ ),
+ ]
from django.db import models
-# Create your models here.
+class Food(models.Model):
+ name = models.TextField(max_length=64)
+ brand = models.TextField(max_length=64)
+ calories = models.PositiveIntegerField()
--- /dev/null
+{% extends 'core/base.html' %}
+
+{% block content %}
+ {% for object in object_list %}
+ <p>{{ object.name }}</p>
+ {% if not forloop.last %}
+ <hr/>
+ {% endif %}
+ {% empty %}
+ <em>No foods found.</em>
+ {% endfor %}
+{% endblock %}
--- /dev/null
+from django.urls import path
+
+from . import views
+
+urlpatterns = (
+ path('', views.index),
+)
-from django.shortcuts import render
+from django.views.generic.list import ListView
-# Create your views here.
+from . import models
+
+class FoodListView(ListView):
+ model = models.Food
+
+index = FoodListView.as_view()
--- /dev/null
+# Generated by Django 4.0.3 on 2022-03-03 16:03
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Exercise',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=64)),
+ ('notes', models.TextField()),
+ ],
+ ),
+ ]
from django.db import models
-# Create your models here.
+class Exercise(models.Model):
+ name = models.CharField(max_length=64)
+ notes = models.TextField()
--- /dev/null
+{% extends 'core/base.html' %}
+
+{% block content %}
+ {% for object in object_list %}
+ <p>{{ object.name }}</p>
+ {% if not forloop.last %}
+ <hr/>
+ {% endif %}
+ {% empty %}
+ <em>No exercises found.</em>
+ {% endfor %}
+{% endblock %}
--- /dev/null
+from django.urls import path
+
+from . import views
+
+urlpatterns = (
+ path('', views.index),
+)
-from django.shortcuts import render
+from django.views.generic.list import ListView
-# Create your views here.
+from . import models
+
+class ExerciseListView(ListView):
+ model = models.Exercise
+
+index = ExerciseListView.as_view()