Compare commits

..
11 Commits
Author SHA1 Message Date
khaloufam70043 8a364f60e5 p8 2019-12-03 15:20:47 +01:00
khaloufam70043 55c9032946 praktikum 7 2019-11-26 15:32:42 +01:00
khaloufam70043 e016462c9f praktikum Sechs bearbeitung 2019-11-26 14:24:40 +01:00
herrerahuezoul67409 1b4eb2d70f first commit 2019-11-26 14:06:02 +01:00
herrerahuezoul67409 c86cae2216 praktikum6 2019-11-19 15:31:28 +01:00
herrerahuezoul67409 73437a9a7a praktikum Sechs bearbeitung 2019-11-19 15:28:55 +01:00
colovicam63900 325e5d8891 letzte aenderung blatt 4 2019-11-05 15:13:23 +01:00
colovicam63900 b7aadda74c Templates 2019-11-05 15:08:44 +01:00
colovicam63900 95d6b4adee PraBlatt3 fertig 2019-10-29 14:54:01 +01:00
colovicam63900 59716deba1 PraBlatt3 2019-10-29 14:28:14 +01:00
colovicam63900 c0653bb776 PraBlatt3 2019-10-29 14:17:52 +01:00
5224 changed files with 256 additions and 9472 deletions

No files matched your search

Executable
+90
View File
@@ -0,0 +1,90 @@
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
*.pot
# Sphinx documentation
docs/_build/
# PyBuilder
target/
### Django ###
*.log
*.pot
*.pyc
**__pycache__/
local_settings.py
.env
**/db.sqlite3
# PyCharm
**/.idea/
Generated Regular → Executable
View File
File mode changed.
Generated Regular → Executable
View File
File mode changed.
Generated Regular → Executable
View File
File mode changed.
Generated Regular → Executable
View File
File mode changed.
-5072
View File
File diff suppressed because it is too large. Load diff
View File
Whitespace-only changes.
-20
View File
@@ -1,20 +0,0 @@
{% extends 'base.html' %}
{% block title %}
News
{% endblock %}
{% block content %}
<h1> Index der Polls-Applikation</h1>
<div class="container">
{% for notice in notices %}
<h3>{{ notice.notice_title }}</h3>
<p>{{ notice.notice_text }}</p>
{% endfor %}
</div>
{% endblock %}
Regular → Executable
BIN
View File
Binary file not shown.
Regular → Executable
View File
File mode changed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Regular → Executable
+4 -3
View File
@@ -20,7 +20,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'fl5b%@nhc2$@uyb)=w_2=#tf@q=%tc63r-4+njboarc*s5&3=e'
SECRET_KEY = 'a7-sm+iebhs_%pupu2emt!he8)x#u_l45vux&kbl6ze4hswfo5'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@@ -37,7 +37,8 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'posts.apps.PostsConfig'
'posts.apps.PostsConfig',
'rest_framework',
]
MIDDLEWARE = [
@@ -105,7 +106,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'de-de'
TIME_ZONE = 'UTC'
Regular → Executable
+2 -15
View File
@@ -1,18 +1,3 @@
"""news URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
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
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
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
@@ -20,3 +5,5 @@ urlpatterns = [
path('posts/', include('posts.urls')),
path('admin/', admin.site.urls),
]
Regular → Executable
View File
File mode changed.
Regular → Executable
View File
File mode changed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Regular → Executable
View File
File mode changed.
Regular → Executable
View File
File mode changed.
+14
View File
@@ -0,0 +1,14 @@
from django import forms
import datetime
class NoticeForm(forms.Form):
date_formats = ['%d.%m.%Y', '%d.%m.%y']
title = forms.CharField(label='Titel', max_length=80)
text = forms.CharField(label='Text', max_length=400)
start = forms.DateField(label='Von',
input_formats=date_formats,
initial=datetime.date.today)
end = forms.DateField(label='Bis',
input_formats=date_formats,
initial=datetime.date.today)
Regular → Executable
+1 -1
View File
@@ -1,4 +1,4 @@
# Generated by Django 2.2.7 on 2019-11-19 13:44
# Generated by Django 2.2.7 on 2019-11-19 13:28
from django.db import migrations, models
Regular → Executable
View File
File mode changed.
Binary file not shown.
Regular → Executable
+5 -4
View File
@@ -1,8 +1,9 @@
from django.db import models
# Create your models here.
class Notice(models.Model):
notice_title = models.CharField(max_length=80)
notice_text = models.CharField(max_length=400)
pub_start = models.DateTimeField()
pub_end = models.DateTimeField()
notice_title = models.CharField(max_length=80)
notice_text = models.CharField(max_length=400)
pub_start = models.DateTimeField()
pub_end = models.DateTimeField()
+7
View File
@@ -0,0 +1,7 @@
from rest_framework import serializers
from .models import Notice
class NoticeSerializer(serializers.ModelSerializer):
class Meta:
model = Notice
fields = ('id', 'notice_title', 'notice_text', 'pub_start', 'pub_end')
Regular → Executable
View File
File mode changed.
Regular → Executable
+5 -1
View File
@@ -2,5 +2,9 @@ from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index')
path('', views.index, name='index'),
path('new', views.new, name='new'),
path('delete/<int:deleteId>', views.delete, name='delete'),
path('notices/', views.notice_list),
path('notices/<int:id>', views.notice_detail),
]
Regular → Executable
+68 -6
View File
@@ -1,12 +1,74 @@
from django.shortcuts import render
from django.shortcuts import render, redirect
from .models import Notice
from django.utils import timezone
from .forms import NoticeForm
from .serializers import NoticeSerializer
from django.http import JsonResponse, HttpResponse
from rest_framework.parsers import JSONParser
from django.views.decorators.csrf import csrf_exempt
# Create your views here.
def index(request):
notices = Notice.objects.all()
notices = notices.filter(pub_start__lte=timezone.now() )
notices = notices.filter(pub_end__gte=timezone.now() )
context = { "notices": notices}
return render(request, 'Posts/index.html', context)
notices = notices.filter(pub_start__lte=timezone.now())
notices = notices.filter(pub_end__gte=timezone.now())
context = {"notices": notices}
return render(request, 'posts/index.html', context)
def new(request):
if request.method == "POST":
form = NoticeForm(request.POST)
if form.is_valid():
newNotice = Notice(notice_title=form.cleaned_data['title'],
notice_text=form.cleaned_data['text'],
pub_start=form.cleaned_data['start'],
pub_end=form.cleaned_data['end'])
newNotice.save()
return redirect('index')
context = {'form': NoticeForm()}
return render(request, 'posts/edit.html', context)
def delete(request, deleteId=None):
if deleteId != None:
delNotice = Notice.objects.get(id=deleteId)
if delNotice != None:
delNotice.delete()
return redirect('index')
@csrf_exempt
def notice_list(request):
if request.method == 'GET':
notices = Notice.objects.all()
serializer = NoticeSerializer(notices, many=True)
return JsonResponse(serializer.data, safe=False)
elif request.method == 'POST':
data = JSONParser().parse(request)
serializer = NoticeSerializer(data=data)
if serializer.is_valid():
serializer.save()
return JsonResponse(serializer.data, status=201)
return JsonResponse(serializer.errors, status=400)
@csrf_exempt
def notice_detail(request, id):
try:
notice = Notice.objects.get(id=id)
except Notice.DoesNotExist:
return HttpResponse(status=404)
if request.method == 'GET':
serializer = NoticeSerializer(notice)
return JsonResponse(serializer.data)
elif request.method == 'PUT':
data = JSONParser().parse(request)
serializer = NoticeSerializer(notice, data=data)
if serializer.is_valid():
serializer.save()
return JsonResponse(serializer.data)
return JsonResponse(serializer.errors, status=400)
elif request.method == 'DELETE':
notice.delete()
return HttpResponse(status=204)
+4 -4
View File
@@ -2,7 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %} Platzhalter {% endblock %} </title>
<title>{% block title %} Platzhalter {% endblock %}</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
@@ -16,7 +18,5 @@
<body>
{% block navigation %} Platzhalter {% endblock %}
{% block content %} Platzhalter {% endblock %}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</body>
</html>
</html>
+17
View File
@@ -0,0 +1,17 @@
{% extends 'base.html' %}
{% block title %}
News
{% endblock %}
{%block content %}
<div class="container">
<h1>Neue Nachricht</h1>
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="save btn btn-default">Speichern</button>
</form>
</div>
{% endblock %}
+26
View File
@@ -0,0 +1,26 @@
{% extends 'base.html' %}
{% block title %}
News
{% endblock %}
{% block content %}
<div class="container">
{% for notice in notices %}
<h3>{{ notice.notice_title }}</h3>
<p>{{ notice.notice_text }}</p>
<p><a href="{% url 'new' %}" class="btn btn-info" role="button">Neue Nachricht</a></p>
<p><a href= "{% url 'delete' deleteId=notice.id %}" class="btn btn-danger">
Meldung loeschen</a></p>
{% endfor %}
</div>
{% endblock %}
Binary file not shown.
Regular → Executable
+1 -1
View File
@@ -37,7 +37,7 @@ deactivate () {
# unset irrelevant variables
deactivate nondestructive
VIRTUAL_ENV="/Users/khaloufam70043/PycharmProjects/Django/venv"
VIRTUAL_ENV="/Users/herrerahuezoul67409/PycharmProjects/Django/venv"
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
Regular → Executable
+1 -1
View File
@@ -8,7 +8,7 @@ alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PA
# Unset irrelevant variables.
deactivate nondestructive
setenv VIRTUAL_ENV "/Users/khaloufam70043/PycharmProjects/Django/venv"
setenv VIRTUAL_ENV "/Users/herrerahuezoul67409/PycharmProjects/Django/venv"
set _OLD_VIRTUAL_PATH="$PATH"
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
Regular → Executable
+1 -1
View File
@@ -29,7 +29,7 @@ end
# unset irrelevant variables
deactivate nondestructive
set -gx VIRTUAL_ENV "/Users/khaloufam70043/PycharmProjects/Django/venv"
set -gx VIRTUAL_ENV "/Users/herrerahuezoul67409/PycharmProjects/Django/venv"
set -gx _OLD_VIRTUAL_PATH $PATH
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
+1 -1
View File
@@ -1,4 +1,4 @@
#!/Users/khaloufam70043/PycharmProjects/Django/venv/bin/python
#!/Users/herrerahuezoul67409/PycharmProjects/Django/venv/bin/python
# -*- coding: utf-8 -*-
import re
+1 -1
View File
@@ -1,4 +1,4 @@
#!/Users/khaloufam70043/PycharmProjects/Django/venv/bin/python
#!/Users/herrerahuezoul67409/PycharmProjects/Django/venv/bin/python
from django.core import management
if __name__ == "__main__":
+1 -1
View File
@@ -1,4 +1,4 @@
#!/Users/khaloufam70043/PycharmProjects/Django/venv/bin/python
#!/Users/herrerahuezoul67409/PycharmProjects/Django/venv/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==39.1.0','console_scripts','easy_install'
__requires__ = 'setuptools==39.1.0'
import re
+1 -1
View File
@@ -1,4 +1,4 @@
#!/Users/khaloufam70043/PycharmProjects/Django/venv/bin/python
#!/Users/herrerahuezoul67409/PycharmProjects/Django/venv/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==39.1.0','console_scripts','easy_install-3.7'
__requires__ = 'setuptools==39.1.0'
import re
+1 -1
View File
@@ -1,4 +1,4 @@
#!/Users/khaloufam70043/PycharmProjects/Django/venv/bin/python
#!/Users/herrerahuezoul67409/PycharmProjects/Django/venv/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip'
__requires__ = 'pip==10.0.1'
import re
+1 -1
View File
@@ -1,4 +1,4 @@
#!/Users/khaloufam70043/PycharmProjects/Django/venv/bin/python
#!/Users/herrerahuezoul67409/PycharmProjects/Django/venv/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3'
__requires__ = 'pip==10.0.1'
import re
+1 -1
View File
@@ -1,4 +1,4 @@
#!/Users/khaloufam70043/PycharmProjects/Django/venv/bin/python
#!/Users/herrerahuezoul67409/PycharmProjects/Django/venv/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3.7'
__requires__ = 'pip==10.0.1'
import re
+1 -1
View File
@@ -1,4 +1,4 @@
#!/Users/khaloufam70043/PycharmProjects/Django/venv/bin/python
#!/Users/herrerahuezoul67409/PycharmProjects/Django/venv/bin/python
# -*- coding: utf-8 -*-
import re
@@ -1 +0,0 @@
pip
@@ -1,27 +0,0 @@
Copyright (c) Django Software Foundation and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of Django nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,84 +0,0 @@
Metadata-Version: 2.1
Name: Django
Version: 2.2.7
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Home-page: https://www.djangoproject.com/
Author: Django Software Foundation
Author-email: foundation@djangoproject.com
License: BSD
Project-URL: Documentation, https://docs.djangoproject.com/
Project-URL: Funding, https://www.djangoproject.com/fundraising/
Project-URL: Source, https://github.com/django/django
Project-URL: Tracker, https://code.djangoproject.com/
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.5
Requires-Dist: pytz
Requires-Dist: sqlparse
Provides-Extra: argon2
Requires-Dist: argon2-cffi (>=16.1.0) ; extra == 'argon2'
Provides-Extra: bcrypt
Requires-Dist: bcrypt ; extra == 'bcrypt'
Django is a high-level Python Web framework that encourages rapid development
and clean, pragmatic design. Thanks for checking it out.
All documentation is in the "``docs``" directory and online at
https://docs.djangoproject.com/en/stable/. If you're just getting started,
here's how we recommend you read the docs:
* First, read ``docs/intro/install.txt`` for instructions on installing Django.
* Next, work through the tutorials in order (``docs/intro/tutorial01.txt``,
``docs/intro/tutorial02.txt``, etc.).
* If you want to set up an actual deployment server, read
``docs/howto/deployment/index.txt`` for instructions.
* You'll probably want to read through the topical guides (in ``docs/topics``)
next; from there you can jump to the HOWTOs (in ``docs/howto``) for specific
problems, and check out the reference (``docs/ref``) for gory details.
* See ``docs/README`` for instructions on building an HTML version of the docs.
Docs are updated rigorously. If you find any problems in the docs, or think
they should be clarified in any way, please take 30 seconds to fill out a
ticket here: https://code.djangoproject.com/newticket
To get more help:
* Join the ``#django`` channel on irc.freenode.net. Lots of helpful people hang
out there. See https://en.wikipedia.org/wiki/Wikipedia:IRC/Tutorial if you're
new to IRC.
* Join the django-users mailing list, or read the archives, at
https://groups.google.com/group/django-users.
To contribute to Django:
* Check out https://docs.djangoproject.com/en/dev/internals/contributing/ for
information about getting involved.
To run Django's test suite:
* Follow the instructions in the "Unit tests" section of
``docs/internals/contributing/writing-code/unit-tests.txt``, published online at
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests
File diff suppressed because it is too large. Load diff
@@ -1,5 +0,0 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.33.1)
Root-Is-Purelib: true
Tag: py3-none-any
@@ -1,3 +0,0 @@
[console_scripts]
django-admin = django.core.management:execute_from_command_line
@@ -1 +0,0 @@
django
View File
File mode changed.
View File
File mode changed.
View File
File mode changed.
View File
File mode changed.
View File
File mode changed.
View File
File mode changed.
File mode changed.
View File
File mode changed.
View File
File mode changed.
File mode changed.
File mode changed.
View File
File mode changed.
View File
File mode changed.
View File
File mode changed.
View File
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
View File
File mode changed.
View File
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
View File
File mode changed.
View File
File mode changed.
File mode changed.
Loaded 100 of 5224 files, more files were not shown because too many files have changed in this diff. Show more