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

django-recurrence funktioniert und sieht sogar einigermaßen hübsch aus

parent f4e07577
No preview for this file type
......@@ -8,6 +8,7 @@
{% bootstrap_css %}
{% bootstrap_javascript jquery='full' %}
<link rel="stylesheet" href="{% static 'css/main.css' %}">
{# fix for #}
......@@ -5,7 +5,7 @@
<a class="btn btn-primary btn-lg" href="#">LOSLEGEN</a>
<div class="row justify-content-center m-2">
<a class="btn btn-primary btn-lg" href="#">TO DO ANLEGEN</a>
<a class="btn btn-primary btn-lg" href="/todo/add/">TO DO ANLEGEN</a>
<div class="row justify-content-center m-2">
<a class="btn btn-primary btn-lg" href="#">TO DOS ANZEIGEN</a>
from django import forms
from recurrence.fields import RecurrenceField
from todo.models import Todo
from recurrence.fields import RecurrenceField
class TodoForm(forms.ModelForm):
class Meta:
model = Todo
exclude = ['created']
# widgets = {
# 'recurrences': RecurrenceField(attrs={'style': 'width:400px; height:400px'})
# }
exclude = ['created', 'complete', 'rank']
widgets = {
'due_date': forms.DateInput(format='%m/%d/%Y',
attrs={'class': 'form-control',
'placeholder': 'TT.MM.JJJJ',
'type': 'date'}),
'text': forms.TextInput(attrs={'placeholder': 'Küche putzen, Python lernen, Haare waschen...'}),
# 'recurrences': RecurrenceField()
labels = {'due_date': 'fällig am',
'text': 'Was ist zu tun? *',
'duration': 'Was meinst du, wie lange die Aufgabe dauert? (in Minuten) *',
'recurrences': 'Wiederholungen'}
class SelectionForm(forms.Form):
.todo-box {
background: lightgrey;
\ No newline at end of file
div.form-control.recurrence-widget{ height: max-content; }
\ No newline at end of file
......@@ -12,14 +12,22 @@ def get_landing_page(request):
context = {'todo_list': todo_list}
return render(request, 'todo/landing_page.html', {'page_title': 'Feierabend!'})
def add_todo(request):
todo = Todo()
if(request.method == 'POST'):
if request.method == 'POST':
form = TodoForm(request.POST, instance=todo)
if form.is_valid():
messages.success(request, "Dein Todo wurde abgespeichert")
return HttpResponseRedirect(reverse_lazy('landing_page'))
messages.error(request, 'Deine Eingabe war leider nicht korrekt.')
form = TodoForm()
return render(request, 'todo/add_todo.html', {'form': form})
return render(request, 'todo/add_todo.html', {'page_title': 'Lege eine neue Aufgabe an! ',
'form': form})
def get_selection_page(request):
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