Commit bebf315d authored by Hänzelmann, Antje's avatar Hänzelmann, Antje
Browse files

Kontakt und Dropdown to do

parent 2d913264
......@@ -9,5 +9,19 @@
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\Users\ahaen\PycharmProjects\oos_2020_todo\db.sqlite3</jdbc-url>
</data-source>
<data-source source="LOCAL" name="db" uuid="f83aaef1-e571-4eda-b86e-3d37c68dc36f">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\Users\ahaen\PycharmProjects\oos_2020_todo\db.sqlite3</jdbc-url>
<libraries>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.31.1/license.txt</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.31.1/sqlite-jdbc-3.31.1.jar</url>
</library>
</libraries>
</data-source>
</component>
</project>
\ No newline at end of file
No preview for this file type
......@@ -16,6 +16,7 @@ import os
import django_heroku
import dj_database_url
import dotenv
from importlib_metadata.tests import data
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -30,7 +31,7 @@ if os.path.isfile(dotenv_file):
SECRET_KEY = '8f&^^5razouamp=m1-_a+pnd_m+4l5+yspjq2b_9q8v@45+!2!'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
ALLOWED_HOSTS = []
......@@ -52,6 +53,7 @@ INSTALLED_APPS = [
'allauth',
'allauth.account',
'allauth.socialaccount',
'contactforms',
]
MIDDLEWARE = [
......@@ -100,10 +102,10 @@ WSGI_APPLICATION = 'oos_2020_todo.wsgi.application'
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
DATABASES = {}
......
......@@ -19,13 +19,16 @@ from django.contrib import admin
from django.urls import path, include
from django.views.i18n import JavaScriptCatalog
from django.conf import settings
from django.urls import path, include
from todo import views
from todo.views import get_landing_page, get_selection_page, todo_details, get_impressum, get_show_todo, \
get_archiv, get_selection_id, delete_todo, redirect_profile
get_archiv, get_selection_id, delete_todo, redirect_profile, get_add_category
urlpatterns = [
path('admin/', admin.site.urls),
path('start/', get_landing_page, name='landing_page'),
path('start/', get_landing_page, name='home'),
path('', get_landing_page, name='landing_page'),
path('selection/', get_selection_page, name='selection_page'),
path('selection/<int:pk>/', get_selection_id, name='selection_id'),
......@@ -38,6 +41,11 @@ urlpatterns = [
path('todo/archiv/', get_archiv, name='archiv'),
path('accounts/', include('allauth.urls')),
path('accounts/profile/', redirect_profile, name="redirect_profile"),
path('contact/', include('contactforms.urls')),
path('category/add/', get_add_category, name="add_category")
# path('todo/add/', views.CreateUserFormView.as_view(), name='todo/add/')
]
if settings.DEBUG:
......
......@@ -8,12 +8,14 @@ billiard==3.3.0.23
celery==3.1.26.post2
certifi==2020.4.5.2
chardet==3.0.4
colorama==0.4.3
crontab==0.22.8
defusedxml==0.6.0
dj-database-url==0.5.0
Django==3.0.7
django-allauth==0.42.0
django-bootstrap4==2.1.0
django-contactforms==2.0
django-crontab==0.7.1
django-heroku==0.3.1
django-post-office==3.4.1
......
{% extends 'todo/base.html' %}
{% load bootstrap4 %}
{% block content %}
<div class="row">
<form action="{% url 'contact' %}" method="post">
<h3>Sende uns eine Nachricht</h3>
{% csrf_token %}
<div class="form-group">
{% if messages %}
{% for message in messages %}
<span{% if message.tags %} class="{{ message.tags }}"{% endif %} style="color: green">{{ message }}</span>
{% endfor %}
{% endif %}
</div>
<div class="form-group">
<input type="text" name="Name" class="form-control" placeholder="Dein Name" maxlength="120" required id="id_name">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="Deine Emailadresse" maxlength="120" required id="id_email">
</div>
<div class="form-group">
<input type="text" name="betreff" class="form-control" placeholder="Betreff" maxlength="120" required id="id_betreff">
</div>
<div class="form-group">
<textarea name="nachricht" cols="40" rows="10" class="form-control" placeholder="Nachricht" required id="id_nachricht"></textarea>
</div>
<button class="btn btn-primary" type="submit">Senden</button>
</form>
</div>
{% endblock %}
{% extends 'todo/base.html' %}
{% load bootstrap4 %}
{% block content %}
<form method="POST" class="post-form">
{% csrf_token %}
{{ form.media }}
{% bootstrap_form form %}
<button class="btn btn-primary" type="submit">Speichern</button>
</form>
{% endblock %}
\ No newline at end of file
{% extends 'todo/base.html' %}
{% load bootstrap4 %}
{% block content %}
<br>
<a class="btn btn-primary" href="{% url 'add_category' %}">Kategorie hinzufügen</a>
<form method="POST" class="post-form">
<br>
{% csrf_token %}
{{ form.media }}
{% bootstrap_form form %}
......@@ -10,4 +17,6 @@
</form>
{% endblock %}
\ No newline at end of file
......@@ -72,6 +72,7 @@
{% block footer %}
<nav class="navbar fixed-bottom navbar-light bg-light">
<a class="navbar-brand" href="{% url 'impressum' %}">Impressum</a>
<a class="navbar-brand" href="{% url 'contact' %}">Kontakt</a>
</nav>
<script type='text/javascript' src={% static 'js/selectionpage.js' %}></script>
<script type='text/javascript' src={% static 'js/showtodos.js' %}></script>
......
......@@ -4,7 +4,6 @@
{% block content %}
<br>
<p>
<b>Angaben gemäß § 5 TMG </b>
<br>
......
......@@ -6,7 +6,7 @@
<div class="card">
<div class="card-body">
<h5 class="card-title">Lege eine neue Aufgabenliste an</h5>
<p class="card-text">Du hast gerade Zeit, um ein paar Dinge zuu erledigen? Super! Dann such dir aus deiner Liste die wichtigsten Dinge aus,
<p class="card-text">Du hast gerade Zeit, um ein paar Dinge zu erledigen? Super! Dann such dir aus deiner Liste die wichtigsten Dinge aus,
schau, wie viel Zeit du hast, und los geht's! Ohne Überforderung, weil du nicht weißt, wo du anfangen sollst, und ohne Stress, weil noch so viel auf deiner Liste steht</p>
<a class="btn btn-primary btn-lg float-right" href="{% url 'selection_page' %}">Aufgabenliste
anlegen</a>
......
from django.contrib import admin
from todo.models import *
from .models import Category
admin.site.register(Todo)
admin.site.register(Selection)
admin.site.register(Category)
from allauth.account.forms import UserForm
from django import forms
from django.forms import ModelForm
from todo.models import Todo
from todo.models import Todo, Category
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django import forms
class CategoryForm(forms.ModelForm):
class Meta:
model = Category
exclude =[]
class CreateUserForm(UserCreationForm):
class Meta:
model = User
......@@ -22,7 +30,8 @@ class TodoForm(forms.ModelForm):
}
labels = {'text': 'Was ist zu tun? *',
'duration': 'Was meinst du, wie lange die Aufgabe dauert? (in Minuten) *',
'recurrences': 'Wiederholungen'}
'recurrences': 'Wiederholungen',
'category': 'Kategorie'}
class SelectionForm(forms.Form):
......
# Generated by Django 3.0.7 on 2020-07-13 10:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todo', '0002_auto_20200706_1431'),
]
operations = [
migrations.CreateModel(
name='Choices',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(choices=[('1', 'Schwimmen'), ('2', 'Lernen'), ('3', 'Lesen'), ('4', 'Malen'), ('5', 'Einkaufen')], max_length=200)),
],
),
migrations.AlterField(
model_name='todo',
name='text',
field=models.CharField(max_length=256),
),
]
# Generated by Django 3.0.7 on 2020-07-13 15:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('todo', '0003_auto_20200713_1248'),
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200)),
],
),
migrations.DeleteModel(
name='Choices',
),
migrations.AddField(
model_name='todo',
name='category',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='todo.Category'),
),
]
......@@ -2,26 +2,44 @@ import datetime
from django.db import models
from recurrence.fields import RecurrenceField
from django import forms
#TODO_CHOICES= [
# ('Malen',),
# ('Schwimmen', 'Lesen'),
# ('Lernen', 'Fotografieren'),
#('Einkaufen', 'Spielen'),
#]
class Selection(models.Model):
total_time = models.IntegerField(default=0) # in minutes
active = models.BooleanField(default=False)
started = models.DateTimeField(default=datetime.datetime.today)
endtime = models.DateTimeField()
#message = models.CharField("Event Type", max_length=12, choices = TODO_CHOICES)
def __str__(self):
return f'Aufgabenliste {self.pk}, Gesamtdauer: {self.total_time.__str__()}'
class Category(models.Model):
title = models.CharField(max_length=200)
def __str__(self):
return self.title
class Todo(models.Model):
text = models.CharField(max_length=200)
#text = models.CharField(max_length=200)
text=models.CharField(max_length=256)
complete = models.BooleanField(default=False)
duration = models.IntegerField(default=15)
created = models.DateField(default=datetime.date.today)
finished = models.DateTimeField(null=True)
recurrences = RecurrenceField(blank=True, null=True)
selection = models.ForeignKey(Selection, on_delete=models.SET_NULL, null=True)
category = models.ForeignKey(Category, on_delete=models.SET_NULL, null=True)
def __str__(self):
return self.text
......@@ -4,32 +4,32 @@ from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect
from django.urls import reverse_lazy
from django.utils import timezone
from django.views.generic import CreateView
from todo.forms import *
from todo.models import *
# def register_page(request):
# if request.user.is_authenticated:
# return redirect('landing_page')
# else:
# form = CreateUserForm()
# if request.method == 'POST':
# form = CreateUserForm(request.POST)
# if form.is_valid():
# form.save()
# return redirect('login')
#
# context = {'form': form}
# return render(request, 'todo/register.html', context)
#
#
# def login_page(request):
# if request.user.is_authenticated:
# return redirect('login')
# else:
# context = {}
# return render(request, 'todo/login.html', context)
@login_required()
def get_add_category(request):
category = Category()
if request.method == 'POST':
form = CategoryForm(request.POST, instance=category)
if form.is_valid():
category = form.instance
category.save()
messages.success(request, "Deine Kategorie wurde hinzugefügt")
return HttpResponseRedirect(reverse_lazy('add_todo'))
else:
messages.error(request, 'Deine Eingabe war leider nicht korrekt.')
else:
form = CategoryForm(instance=category)
return render(request, 'todo/add_category.html', {'page_title': 'Füge eine neue Kategorie hinzu! ',
'form': form})
@login_required()
......@@ -73,7 +73,6 @@ def todo_details(request, pk=None):
return render(request, 'todo/add_todo.html', {'page_title': 'Lege eine neue Aufgabe an! ',
'form': form})
@login_required()
def delete_todo(request, pk=None, source='show_todo', s_id=None):
if pk:
......@@ -195,6 +194,10 @@ def get_impressum(request):
content = {'page_title': 'Impressum'}
return render(request, 'todo/impressum.html', content)
def get_contact(request):
content = {'page_title': 'Kontakt'}
return render(request, 'todo/../templates/contact/contact.html', content)
@login_required()
def get_show_todo(request):
......@@ -244,3 +247,5 @@ def get_archiv(request):
@login_required()
def redirect_profile(request):
return HttpResponseRedirect(reverse_lazy('landing_page'))
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