Commit 294ceb28 authored by dorothee.kueppers's avatar dorothee.kueppers
Browse files

alles etwas hübscher und Fehler behoben

parent 22f70bc8
......@@ -40,6 +40,7 @@ INSTALLED_APPS = [
'todo',
'bootstrap4',
'recurrence',
'django_crontab',
]
MIDDLEWARE = [
......@@ -130,3 +131,7 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# os.path.join(BASE_DIR, "static"),
# # '/var/www/static/',
# ]
CRONJOBS = [
('0 */1 * * * *', 'todo.cron.email_todays_todos')
]
\ No newline at end of file
......@@ -31,7 +31,7 @@ urlpatterns = [
path('selection/<int:pk>/', get_selection_id, name='selection_id'),
path('todo/add/', todo_details, name='add_todo'),
path('todo/edit/<int:pk>/', todo_details, name='edit_todo'),
path('todo/delte/<int:pk>/', delete_todo, name='delete_todo'),
path('todo/delete/<int:pk>/<str:source>/<int:s_id>', delete_todo, name='delete_todo'),
path('impressum/', get_impressum, name='impressum'),
path('todo/show/', get_show_todo, name='show_todo'),
path('todo/archiv/', get_archiv, name='archiv'),
......
......@@ -51,11 +51,11 @@
</div>
<!-- Navbar auf rechter Seite/Log In und Register Seite-->
<div class="navbar-nav">
<a class="nav-item nav-link active" href="todo/login">Login</a>
<a class="nav-item nav-link active" href="{% url 'login' %}">Login</a>
</div>
<div class="navbar-nav">
<a class="nav-item nav-link active" href="todo/register">Register</a>
<a class="nav-item nav-link active" href="{% url 'register' %}">Register</a>
</div>
</nav>
......
......@@ -2,23 +2,60 @@
{% block content %}
{% if not running_selection %}
<div class="row justify-content-center m-2">
<a class="btn btn-primary btn-lg" href="{% url 'selection_page' %}">Aufgabenliste Anlegen</a>
</div>
<div class="row justify-content-center m-2">
<div class="card">
<div class="card-body">
<h5 class="card-title">Lege eine neue Aufgabenliste an</h5>
<p class="card-text">Hier ein netter Text... Hier ein netter Text... Hier ein netter Text...Hier ein
netter Text....</p>
<a class="btn btn-primary btn-lg float-right" href="{% url 'selection_page' %}">Aufgabenliste
anlegen</a>
</div>
</div>
</div>
{% endif %}
{% if running_selection %}
<div class="row justify-content-center m-2">
<a class="btn btn-primary btn-lg" href="{% url 'selection_id' pk=selection.id %}">aktuelle Aufgabenliste</a>
</div>
<div class="row justify-content-center m-2">
<div class="card">
<div class="card-body">
<h5 class="card-title">Schaue dir deine aktuelle Aufgabenliste an</h5>
<p class="card-text">Hier ein netter Text... Hier ein netter Text... Hier ein netter Text...Hier ein
netter Text....</p>
<a class="btn btn-primary btn-lg float-right" href="{% url 'selection_id' pk=selection.id %}">Aktuelle
Aufgabenliste</a>
</div>
</div>
</div>
{% endif %}
<div class="row justify-content-center m-2">
<a class="btn btn-primary btn-lg" href="{% url 'add_todo' %}">Neue Aufgabe Anlegen</a>
<div class="card">
<div class="card-body">
<h5 class="card-title">Lege eine neue Aufgabe an</h5>
<p class="card-text">Hier ein netter Text... Hier ein netter Text... Hier ein netter Text...Hier ein
netter Text....</p>
<a class="btn btn-primary btn-lg float-right" href="{% url 'add_todo' %}">Neue Aufgabe Anlegen</a>
</div>
</div>
</div>
<div class="row justify-content-center m-2">
<a class="btn btn-primary btn-lg" href="{% url 'show_todo' %}">Alle Aufgaben anzeigen</a>
<div class="card">
<div class="card-body">
<h5 class="card-title">Zeige alle Aufgaben an</h5>
<p class="card-text">Hier ein netter Text... Hier ein netter Text... Hier ein netter Text...Hier ein
netter Text....</p>
<a class="btn btn-primary btn-lg float-right" href="{% url 'show_todo' %}">Alle Aufgaben anzeigen</a>
</div>
</div>
</div>
<div class="row justify-content-center m-2">
<a class="btn btn-primary btn-lg" href="{% url 'archiv' %}">Archiv</a>
<div class="card">
<div class="card-body">
<h5 class="card-title">Schaue dir alte Aufgaben an</h5>
<p class="card-text">Hier ein netter Text... Hier ein netter Text... Hier ein netter Text...Hier ein
netter Text....</p>
<a class="btn btn-primary btn-lg float-right" href="{% url 'archiv' %}">Archiv</a>
</div>
</div>
</div>
{% endblock %}
......@@ -20,7 +20,8 @@
<div id="timing-messages">
<p class="text-center" id="avail-time"></p>
<p class="text-center" id="chosen-time"></p>
<p class="text-center warning" id="time-warning">Wahrscheinlich nimmst du dir gerade zu viel vor. Konzentriere dich auf das Wichtigste ;)</p>
<p class="text-center warning" id="time-warning">Wahrscheinlich nimmst du dir gerade zu viel vor.
Konzentriere dich auf das Wichtigste ;)</p>
</div>
<div id="choices">
<ul class="list-group">
......@@ -53,14 +54,18 @@
data-parent="#accordion">
<div class="card-body" id="body-late">
<div class="list-group list-group-flush">
{% for todo in todos_late %}
<div class="list-group-item list-group-item-action select-todo-grid">
<div class="todo-text">{{ todo.0.text }}</div>
<div class="todo-duration">{{ todo.0.duration }} Minuten</div>
<div class="todo-due">{{ todo.1 }}</div>
<div class="todo-id" hidden>{{ todo.0.id }}</div>
</div>
{% endfor %}
{% if todos_late %}
{% for todo in todos_late %}
<div class="list-group-item list-group-item-action select-todo-grid">
<div class="todo-text">{{ todo.0.text }}</div>
<div class="todo-duration">{{ todo.0.duration }} Minuten</div>
<div class="todo-due">{{ todo.1 }}</div>
<div class="todo-id" hidden>{{ todo.0.id }}</div>
</div>
{% endfor %}
{% else %}
<p>Keine Aufgaben in dieser Kategorie!</p>
{% endif %}
</div>
</div>
</div>
......@@ -78,14 +83,18 @@
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
<div class="list-group list-group-flush">
{% for todo in todos_today %}
<div class="list-group-item list-group-item-action select-todo-grid">
<div class="todo-text">{{ todo.0.text }}</div>
<div class="todo-duration">{{ todo.0.duration }} Minuten</div>
<div class="todo-due">{{ todo.1 }}</div>
<div class="todo-id" hidden>{{ todo.0.id }}</div>
</div>
{% endfor %}
{% if todos_today %}
{% for todo in todos_today %}
<div class="list-group-item list-group-item-action select-todo-grid">
<div class="todo-text">{{ todo.0.text }}</div>
<div class="todo-duration">{{ todo.0.duration }} Minuten</div>
<div class="todo-due">{{ todo.1 }}</div>
<div class="todo-id" hidden>{{ todo.0.id }}</div>
</div>
{% endfor %}
{% else %}
<p>Keine Aufgaben in dieser Kategorie!</p>
{% endif %}
</div>
</div>
</div>
......@@ -104,14 +113,18 @@
data-parent="#accordion">
<div class="card-body">
<div class="list-group list-group-flush">
{% for todo in todos_soon %}
<div class="list-group-item list-group-item-action select-todo-grid">
<div class="todo-text">{{ todo.0.text }}</div>
<div class="todo-duration">{{ todo.0.duration }} Minuten</div>
<div class="todo-due">{{ todo.1 }}</div>
<div class="todo-id" hidden>{{ todo.0.id }}</div>
</div>
{% endfor %}
{% if todos_soon %}
{% for todo in todos_soon %}
<div class="list-group-item list-group-item-action select-todo-grid">
<div class="todo-text">{{ todo.0.text }}</div>
<div class="todo-duration">{{ todo.0.duration }} Minuten</div>
<div class="todo-due">{{ todo.1 }}</div>
<div class="todo-id" hidden>{{ todo.0.id }}</div>
</div>
{% endfor %}
{% else %}
<p>Keine Aufgaben in dieser Kategorie!</p>
{% endif %}
</div>
</div>
</div>
......@@ -130,13 +143,17 @@
data-parent="#accordion">
<div class="card-body">
<ul class="list-group list-group-flush">
{% for todo in todos_someday %}
<div class="list-group-item list-group-item-action select-todo-grid">
<div class="todo-text">{{ todo.text }}</div>
<div class="todo-duration">{{ todo.duration }} Minuten</div>
<div class="todo-id" hidden>{{ todo.id }}</div>
</div>
{% endfor %}
{% if todos_someday %}
{% for todo in todos_someday %}
<div class="list-group-item list-group-item-action select-todo-grid">
<div class="todo-text">{{ todo.text }}</div>
<div class="todo-duration">{{ todo.duration }} Minuten</div>
<div class="todo-id" hidden>{{ todo.id }}</div>
</div>
{% endfor %}
{% else %}
<p>Keine Aufgaben in dieser Kategorie!</p>
{% endif %}
</ul>
</div>
</div>
......
{% extends 'todo/base.html' %}
{% load bootstrap4 %}
{% block content %}
<div id="show-todos">
<div class="row justify-content-center">
<form action="" method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{ form }}
<input type="submit" class="btn btn-primary" value="Änderungen speichern">
</form>
</div>
<div class="row justify-content-center">
<div id="accordion">
<div class="card">
<div class="card-header todo-late" id="headingOne">
<h5 class="mb-0">
<button class="btn btn-link todo-late" data-toggle="collapse" data-target="#collapseOne"
aria-expanded="true" aria-controls="collapseOne">
Dinge, die eigentlich schon getan sein sollten
</button>
</h5>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne"
data-parent="#accordion">
<div class="card-body" id="body-late">
<div class="list-group list-group-flush">
{% if todos_late %}
{% for todo in todos_late %}
<div class="list-group-item list-group-item-action select-todo-grid-show">
<input class="todo-check" type="checkbox">
<div class="todo-text">{{ todo.0.text }}</div>
<div class="todo-duration">{{ todo.0.duration }} Minuten</div>
<div class="todo-due">{{ todo.1 }}</div>
<div class="todo-edit">
<a href="{% url 'edit_todo' pk=todo.0.id %}">
<span class="material-icons">edit</span>
</a>
</div>
<div class="todo-delete">
<a href="{% url 'delete_todo' pk=todo.0.id source='selection_id' s_id=pk %}">
<span class="material-icons">delete</span>
</a>
</div>
<div class="todo-id" hidden>{{ todo.0.id }}</div>
</div>
{% endfor %}
{% else %}
<p>Keine Aufgaben in dieser Kategorie!</p>
{% endif %}
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header todo-today" id="headingTwo">
<h5 class="mb-0">
<button class="btn btn-link collapsed todo-today" data-toggle="collapse"
data-target="#collapseTwo"
aria-expanded="false" aria-controls="collapseTwo">
Dinge, die heute zu erledigen sind
</button>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
<div class="list-group list-group-flush">
{% if todos_today %}
{% for todo in todos_today %}
<div class="list-group-item list-group-item-action select-todo-grid-show">
<input class="todo-check" type="checkbox">
<div class="todo-text">{{ todo.0.text }}</div>
<div class="todo-duration">{{ todo.0.duration }} Minuten</div>
<div class="todo-due">{{ todo.1 }}</div>
<div class="todo-edit">
<a href="{% url 'edit_todo' pk=todo.0.id %}">
<span class="material-icons">edit</span>
</a>
</div>
<div class="todo-delete">
<a href="{% url 'delete_todo' pk=todo.0.id source='selection_id' s_id=pk %}">
<span class="material-icons">delete</span>
</a>
</div>
<div class="todo-id" hidden>{{ todo.0.id }}</div>
</div>
{% endfor %}
{% else %}
<p>Keine Aufgaben in dieser Kategorie!</p>
{% endif %}
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header todo-soon" id="headingThree">
<h5 class="mb-0">
<button class="btn btn-link collapsed todo-soon" data-toggle="collapse"
data-target="#collapseThree" aria-expanded="false"
aria-controls="collapseThree">
Dinge, die bald zu erledigen sind
</button>
</h5>
</div>
<div id="collapseThree" class="collapse" aria-labelledby="headingThree"
data-parent="#accordion">
<div class="card-body">
<div class="list-group list-group-flush">
{% if todos_soon %}
{% for todo in todos_soon %}
<div class="list-group-item list-group-item-action select-todo-grid-show">
<input class="todo-check" type="checkbox">
<div class="todo-text">{{ todo.0.text }}</div>
<div class="todo-duration">{{ todo.0.duration }} Minuten</div>
<div class="todo-due">{{ todo.1 }}</div>
<div class="todo-edit">
<a href="{% url 'edit_todo' pk=todo.0.id %}">
<span class="material-icons">edit</span>
</a>
</div>
<div class="todo-delete">
<a href="{% url 'delete_todo' pk=todo.0.id source='selection_id' s_id=pk %}">
<span class="material-icons">delete</span>
</a>
</div>
<div class="todo-id" hidden>{{ todo.0.id }}</div>
</div>
{% endfor %}
{% else %}
<p>Keine Aufgaben in dieser Kategorie!</p>
{% endif %}
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header todo-someday" id="headingFour">
<h5 class="mb-0">
<button class="btn btn-link collapsed todo-someday" data-toggle="collapse"
data-target="#collapseFour" aria-expanded="false"
aria-controls="collapseFour">
Dinge, die keinen Zeitdruck haben
</button>
</h5>
</div>
<div id="collapseFour" class="collapse" aria-labelledby="headingFour"
data-parent="#accordion">
<div class="card-body">
<ul class="list-group list-group-flush">
{% if todos_someday %}
{% for todo in todos_someday %}
<div class="list-group-item list-group-item-action select-todo-grid-show">
<input class="todo-check" type="checkbox">
<div class="todo-text">{{ todo.text }}</div>
<div class="todo-duration">{{ todo.duration }} Minuten</div>
<div class="todo-edit">
<a href="{% url 'edit_todo' pk=todo.0.id %}">
<span class="material-icons">edit</span>
</a>
</div>
<div class="todo-delete">
<a href="{% url 'delete_todo' pk=todo.0.id source='selection_id' s_id=pk %}">
<span class="material-icons">delete</span>
</a>
</div>
<div class="todo-id" hidden>{{ todo.id }}</div>
</div>
{% endfor %}
{% else %}
<p>Keine Aufgaben in dieser Kategorie!</p>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
......@@ -39,7 +39,7 @@
</a>
</div>
<div class="todo-delete">
<a href="{% url 'delete_todo' pk=todo.0.id %}">
<a href="{% url 'delete_todo' pk=todo.0.id source='show_todo' s_id=None %}">
<span class="material-icons">delete</span>
</a>
</div>
......@@ -79,7 +79,7 @@
</a>
</div>
<div class="todo-delete">
<a href="{% url 'delete_todo' pk=todo.0.id %}">
<a href="{% url 'delete_todo' pk=todo.0.id source='show_todo' s_id=None %}">
<span class="material-icons">delete</span>
</a>
</div>
......@@ -120,7 +120,7 @@
</a>
</div>
<div class="todo-delete">
<a href="{% url 'delete_todo' pk=todo.0.id %}">
<a href="{% url 'delete_todo' pk=todo.0.id source='show_todo' s_id=None %}">
<span class="material-icons">delete</span>
</a>
</div>
......@@ -160,7 +160,7 @@
</a>
</div>
<div class="todo-delete">
<a href="{% url 'delete_todo' pk=todo.0.id %}">
<a href="{% url 'delete_todo' pk=todo.0.id source='show_todo' s_id=None %}">
<span class="material-icons">delete</span>
</a>
</div>
......
def email_todays_todos():
print('Hello world!')
return True
# Generated by Django 3.0.7 on 2020-07-05 22:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('todo', '0010_auto_20200705_1539'),
]
operations = [
migrations.RemoveField(
model_name='selection',
name='name',
),
]
......@@ -5,8 +5,6 @@ from recurrence.fields import RecurrenceField
class Selection(models.Model):
name = models.CharField(max_length=30, default="name")
# items = models.ManyToManyField(Todo)
total_time = models.IntegerField(default=0) # in minutes
active = models.BooleanField(default=False)
started = models.DateTimeField(default=datetime.datetime.today)
......@@ -16,7 +14,6 @@ class Selection(models.Model):
return f'{self.name}, total time: {self.total_time.__str__()}'
class Todo(models.Model):
text = models.CharField(max_length=200)
complete = models.BooleanField(default=False)
......
......@@ -115,6 +115,11 @@ if($('#todo-choices').length) {
let minutes = parseInt($durationMinutes.val());
total_time = hours * 60 + minutes;
setAvailTimeString(hours, minutes);
if (duration_todos > total_time) {
$('#time-warning').show();
} else {
$('#time-warning').hide();
}
}
......
import logging
from django.contrib import messages
from django.db.models import Max, Model
from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect
from django.contrib import messages
from django.urls import reverse_lazy
from django.utils import timezone
from django.contrib.auth.forms import UserCreationForm
from .forms import CreateUserForm
from todo.forms import *
from todo.models import *
def registerPage(request):
logger = logging.getLogger('views')
def register_page(request):
form = CreateUserForm()
if request.method =='POST':
if request.method == 'POST':
form = CreateUserForm(request.POST)
if form.is_valid():
form.save()
return redirect('login')
context={'form':form}
return render(request, 'accounts/register.html', context)
context = {'form': form}
return render(request, 'todo/register.html', context)
def login_page(request):
context = {}
return render(request, 'todo/login.html', context)
def loginPage(request):
context={}
return render(request, 'accounts/login.html', context)
def get_landing_page(request):
logger.info("Hallo")
try:
selection = Selection.objects.filter(active=True).latest('endtime')
except Model.DoesNotExist:
......@@ -74,10 +77,13 @@ def todo_details(request, pk=None):
'form': form})
def delete_todo(request, pk=None):
def delete_todo(request, pk=None, source='show_todo', s_id=None):
if pk:
Todo.objects.get(pk=pk).delete()
return HttpResponseRedirect(reverse_lazy('show_todo'))
if source == 'selection_id':
return HttpResponseRedirect(reverse_lazy(source, kwargs={'pk': s_id}))
else:
return HttpResponseRedirect(reverse_lazy(source))
def get_selection_page(request):
......@@ -108,7 +114,7 @@ def get_selection_page(request):
todos_someday = []
sort_todos(todos_late, todos_someday, todos_soon, todos_today)
content = {'page_title': 'Leg eine Liste an',
content = {'page_title': 'Leg eine neue Aufgabenliste an',
'form': form,
'todos_today': todos_today,
'todos_soon': todos_soon,
......@@ -150,9 +156,9 @@ def get_selection_id(request, pk=None):
'todos_late': todos_late,
'todos_someday': todos_someday,
'todos_selection': [],
'pk': pk
}
# content = {'page_title': 'to Dos anzeigen'}
return render(request, 'todo/show_todo.html', content)
return render(request, 'todo/show_selection.html', content)
def sort_todos(todos_late, todos_someday, todos_soon, todos_today, select_id=None):
......
Markdown is supported
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