Commit d775b86c authored by dorothee.kueppers's avatar dorothee.kueppers
Browse files

ein paar Sachen eingefügt

parent ad952f17
No preview for this file type
......@@ -7,7 +7,7 @@ Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other _app.views import Home
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
......@@ -16,10 +16,11 @@ Including another URLconf
from django.contrib import admin
from django.urls import path
from todo.views import get_landing_page
from todo.views import get_landing_page, get_selection_page
urlpatterns = [
path('admin/', admin.site.urls),
path('start/', get_landing_page, name='landing_page'),
path('', get_landing_page),
path('selection/', get_selection_page, name='get_selection_page'),
]
{% load bootstrap4 %}
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
......
{% extends 'todo/base.html' %}
{% load static %}
{% block content %}
<div class="row">
<div class="col-sm todo-box">
<div class="row justify-content-center">
<h3>Wie viel Zeit hast du?</h3>
</div>
<div class="row justify-content-center">
<input type="time"/>
</div>
</div>
<div class="col-sm todo-box">
<div class="row justify-content-center">
<img src="{% static "todo/mole.png" %}" width="100px" height="100px"/>
</div>
</div>
</div>
{% endblock %}
from django.contrib import admin
from todo.models import *
# Register your models here.
from .models import Todo
admin.site.register(Todo)
admin.site.register(Selection)
......@@ -7,3 +7,12 @@ class Todo(models.Model):
def __str__(self):
return self.text
class Selection(models.Model):
name = models.CharField(max_length=30)
items = models.ManyToManyField(Todo)
total_time = models.TimeField(default=0)
def __str__(self):
return f'{self.name} , duration: {self.total_time.__str__()}'
.todo-box {
background: lightgrey;
}
\ No newline at end of file
from django.shortcuts import render
from .models import Todo
from todo.models import *
def get_landing_page(request):
todo_list = Todo.objects.order_by('id')
context ={'todo_list' : todo_list}
return render(request, 'todo/landing_page.html', {'page_title':'Feierabend!'})
def get_selection_page(request):
selection = Selection()
return render(request, 'todo/selection_page.html', {'page_title': 'Leg eine Liste an!',
'selection': selection})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment