Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99eaafff00 | ||
|
|
446a55f3e5 | ||
|
|
2f970d6eb4 | ||
|
|
c1deabc692 | ||
|
|
fb3e425471 | ||
|
|
46bc47f046 | ||
|
|
8db2774f7c | ||
|
|
272498b4ce | ||
|
|
12323615c7 | ||
| 9d6857cfe2 |
6
CHANGELOG
Normal file
6
CHANGELOG
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
- getSeason() only for staff members
|
||||||
|
- new view staff()
|
||||||
|
- updated bootstrap to version 3.4.1
|
||||||
|
- updated jquery to 3.6.3
|
||||||
|
- changed container layout in main view 'matchday'
|
||||||
|
|
||||||
0
TipPy/__init__.py
Normal file
0
TipPy/__init__.py
Normal file
16
TipPy/asgi.py
Normal file
16
TipPy/asgi.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
ASGI config for TipPy project.
|
||||||
|
|
||||||
|
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TipPy.settings')
|
||||||
|
|
||||||
|
application = get_asgi_application()
|
||||||
146
TipPy/settings.py
Normal file
146
TipPy/settings.py
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
"""
|
||||||
|
Django settings for TipPy project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 4.0.6.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/4.0/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/4.0/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
# Quick-start development settings - unsuitable for production
|
||||||
|
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'django-insecure-jiw8js(^@d)no7tv(oq+ugl3kj=f8@j-kz3bj530&!%!$cjqj9'
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'django.contrib.humanize',
|
||||||
|
'tipp'
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'TipPy.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [BASE_DIR / 'templates']
|
||||||
|
,
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'TipPy.wsgi.application'
|
||||||
|
WSGI_APPLICATION = 'TipPy.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
'NAME': 'tippy',
|
||||||
|
'USER': 'tippy',
|
||||||
|
'PASSWORD': 'tippy',
|
||||||
|
'HOST': 'localhost',
|
||||||
|
'PORT': '5432',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
||||||
|
LANGUAGE_CODE = 'de-de'
|
||||||
|
TIME_ZONE = 'Europe/Berlin'
|
||||||
|
USE_I18N = True
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||||
|
# Example: "/home/media/media.lawrence.com/media/"
|
||||||
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
||||||
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||||
|
# trailing slash.
|
||||||
|
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
# Absolute path to the directory static files should be collected to.
|
||||||
|
# Don't put anything in this directory yourself; store your static files
|
||||||
|
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||||
|
# Example: "/home/media/media.lawrence.com/static/"
|
||||||
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
|
||||||
|
|
||||||
|
if not DEBUG:
|
||||||
|
STATIC_ROOT = ''
|
||||||
|
|
||||||
|
STATICFILES_DIRS = [
|
||||||
|
#os.path.join(BASE_DIR, 'static/'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# STATIC_ROOT=os.path.join(BASE_DIR,"static/")
|
||||||
|
# STATIC_URL = 'static/'
|
||||||
|
# STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'), ]
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
# Redirect on logout
|
||||||
|
LOGOUT_REDIRECT_URL = "home"
|
||||||
8
TipPy/urls.py
Normal file
8
TipPy/urls.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from django.contrib import admin, auth
|
||||||
|
from django.urls import include, path, re_path
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('', include('tipp.urls')),
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
]
|
||||||
|
|
||||||
16
TipPy/wsgi.py
Normal file
16
TipPy/wsgi.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
WSGI config for TipPy project.
|
||||||
|
|
||||||
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TipPy.settings')
|
||||||
|
|
||||||
|
application = get_wsgi_application()
|
||||||
6
requirements.txt
Normal file
6
requirements.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Django~=4.1.7
|
||||||
|
psycopg2~=2.9.5
|
||||||
|
suds~=1.1.2
|
||||||
|
Pillow~=9.4.0
|
||||||
|
pytz~=2023.2
|
||||||
|
urllib3~=1.26.15
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
{% load i18n static %}
|
{% load i18n static %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}javascript/tippy.js"></script>
|
<script type="text/javascript" src="{% static 'javascript/tippy.js' %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block nav %}
|
{% block nav %}
|
||||||
|
|||||||
@@ -16,13 +16,13 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<!-- Bootstrap -->
|
<!-- Bootstrap -->
|
||||||
<link href="{{ STATIC_URL }}css/bootstrap.min.css" rel="stylesheet">
|
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
|
||||||
|
|
||||||
<!-- Bootstrap-Theme -->
|
<!-- Bootstrap-Theme -->
|
||||||
<link href="{{ STATIC_URL }}css/bootstrap-theme.min.css" rel="stylesheet">
|
<link href="{% static 'css/bootstrap-theme.min.css' %}" rel="stylesheet">
|
||||||
|
|
||||||
<!-- Bootstrap-Theme -->
|
<!-- Bootstrap-Theme -->
|
||||||
<link href="{{ STATIC_URL }}css/tippy-bootstrap.css" rel="stylesheet">
|
<link href="{% static 'css/tippy-bootstrap.css' %}" rel="stylesheet">
|
||||||
|
|
||||||
<!-- Unterstützung für Media Queries und HTML5-Elemente im Internet Explorer über HTML5 shim und Respond.js -->
|
<!-- Unterstützung für Media Queries und HTML5-Elemente im Internet Explorer über HTML5 shim und Respond.js -->
|
||||||
<!-- ACHTUNG: Respond.js funktioniert nicht, wenn du die Seite über file:// aufrufst -->
|
<!-- ACHTUNG: Respond.js funktioniert nicht, wenn du die Seite über file:// aufrufst -->
|
||||||
@@ -36,9 +36,9 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<!-- jQuery (wird für Bootstrap JavaScript-Plugins benötigt) -->
|
<!-- jQuery (wird für Bootstrap JavaScript-Plugins benötigt) -->
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
|
||||||
<!-- Binde alle kompilierten Plugins zusammen ein (wie hier unten) oder such dir einzelne Dateien nach Bedarf aus -->
|
<!-- Binde alle kompilierten Plugins zusammen ein (wie hier unten) oder such dir einzelne Dateien nach Bedarf aus -->
|
||||||
<script src="{{ STATIC_URL }}js/bootstrap.min.js"></script>
|
<script src="{% static 'js/bootstrap.min.js'%}"></script>
|
||||||
|
|
||||||
{% block nav %}{% endblock %}
|
{% block nav %}{% endblock %}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<p>
|
<p>
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
© Martin Bley, 2014-2016 | Dank an
|
© Martin Bley, 2014-2023 | Dank an
|
||||||
<a href="http://openligadb.de">OpenLigaDB</a> für die Bereitstellung der
|
<a href="http://openligadb.de">OpenLigaDB</a> für die Bereitstellung der
|
||||||
Spielergebnisse.
|
Spielergebnisse.
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,70 +2,74 @@
|
|||||||
{% load i18n static %}
|
{% load i18n static %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<title> TipPy Blog</title>
|
<title> TipPy Blog</title>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block nav %}
|
{% block nav %}
|
||||||
{% include "nav.html" with ls=ls season=season %}
|
{% include "nav.html" with ls=ls season=season %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div id="content-main">
|
<div id="content-main">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<h2>TipPy Blog</h2>
|
<h2>TipPy Blog</h2>
|
||||||
<p class="text-right">
|
<p class="text-right">
|
||||||
<a class="btn btn-default" href="/blog/newpost" role="button">Neue Nachricht</a>
|
<a class="btn btn-default" href="/blog/newpost" role="button">Neue Nachricht</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% for post, avatar in posts %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-7">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
{{post.author.first_name}} schrieb {{post.created|naturaltime}}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<ul class="media-list">
|
||||||
{% if avatar %}
|
{% for post, avatar in posts %}
|
||||||
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic" src="/media/{{avatar}}" />
|
<li class="media">
|
||||||
{% else %}
|
<a href="#" class="pull-left">
|
||||||
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic" src="/media/profiles/dummy.png" />
|
{% if avatar %}
|
||||||
{% endif %}
|
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic"
|
||||||
{{post.content|safe}}
|
src="/media/{{ avatar }}"/>
|
||||||
</div>
|
{% else %}
|
||||||
</div>
|
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic"
|
||||||
</div>
|
src="/media/profiles/dummy.png"/>
|
||||||
</div>
|
{% endif %}
|
||||||
{% endfor %}
|
</a>
|
||||||
<div class="row">
|
<div class="media-body">
|
||||||
<div class="col-md-7">
|
<span class="text-muted pull-right">
|
||||||
<nav>
|
<small class="text-muted">{{ post.created|naturaltime }}</small>
|
||||||
<ul class="pager">
|
</span>
|
||||||
{% if posts.has_previous %}
|
<strong class="text-success">{{ post.author.first_name }}</strong>
|
||||||
<li data-toggle="tooltip" title="{% trans 'previous' %}" class="previous">
|
<p>{{ post.content|safe }}</p>
|
||||||
<a href="/blog/{{ page|add:"-1" }}">
|
</div>
|
||||||
{% else %}
|
</li>
|
||||||
<li data-toggle="tooltip" title="{% trans 'previous' %}" class="previous inactive">
|
{% endfor %}
|
||||||
<a href="/blog/{{ page }}">
|
|
||||||
{% endif %}
|
|
||||||
<span aria-hidden="true">←</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
Seite {{ posts.number }} von {{ posts.paginator.num_pages }}.
|
|
||||||
{% if posts.has_next %}
|
|
||||||
<li data-toggle="tooltip" title="{% trans 'next' %}" class="next">
|
|
||||||
<a href="/blog/{{ page|add:"1" }}">
|
|
||||||
{% else %}
|
|
||||||
<li data-toggle="tooltip" title="{% trans 'next' %}" class="next inactive">
|
|
||||||
<a href="/blog/{{ page }}">
|
|
||||||
{% endif %}
|
|
||||||
<span aria-hidden="true">→</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7">
|
||||||
|
<nav>
|
||||||
|
<ul class="pager">
|
||||||
|
{% if posts.has_previous %}
|
||||||
|
<li data-toggle="tooltip" title="{% trans 'previous' %}" class="previous">
|
||||||
|
<a href="/blog/{{ page|add:"-1" }}">
|
||||||
|
{% else %}
|
||||||
|
<li data-toggle="tooltip" title="{% trans 'previous' %}" class="previous inactive">
|
||||||
|
<a href="/blog/{{ page }}">
|
||||||
|
{% endif %}
|
||||||
|
<span aria-hidden="true">←</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
Seite {{ posts.number }} von {{ posts.paginator.num_pages }}.
|
||||||
|
{% if posts.has_next %}
|
||||||
|
<li data-toggle="tooltip" title="{% trans 'next' %}" class="next">
|
||||||
|
<a href="/blog/{{ page|add:"1" }}">
|
||||||
|
{% else %}
|
||||||
|
<li data-toggle="tooltip" title="{% trans 'next' %}" class="next inactive">
|
||||||
|
<a href="/blog/{{ page }}">
|
||||||
|
{% endif %}
|
||||||
|
<span aria-hidden="true">→</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
28
templates/chat.xhtml
Normal file
28
templates/chat.xhtml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{% load humanize %}
|
||||||
|
<hr>
|
||||||
|
<p class="text-left">
|
||||||
|
<a class="btn btn-default" href="/blog/newpost" role="button">neuer Post</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul class="media-list">
|
||||||
|
{% for post, avatar in posts %}
|
||||||
|
<li class="media">
|
||||||
|
<a href="#" class="pull-left">
|
||||||
|
{% if avatar %}
|
||||||
|
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic"
|
||||||
|
src="/media/{{ avatar }}"/>
|
||||||
|
{% else %}
|
||||||
|
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic"
|
||||||
|
src="/media/profiles/dummy.png"/>
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
<div class="media-body">
|
||||||
|
<span class="text-muted pull-right">
|
||||||
|
<small class="text-muted">{{ post.created|naturaltime }}</small>
|
||||||
|
</span>
|
||||||
|
<strong class="text-success">{{ post.author.first_name }}</strong>
|
||||||
|
<p>{{ post.content|safe }}</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
{% load url from future %}
|
|
||||||
{% comment %}
|
|
||||||
Main page to authenticate users.
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% block head %}
|
|
||||||
<title>TipPy | Login</title>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block nav %}
|
|
||||||
{% include "nav_login.html" with ls=ls season=season %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
{% if form.errors %}
|
|
||||||
<div class="row">
|
|
||||||
<p>Benutzename und Passwort passen nicht zusammen. Bitte versuche es noch einmal.</p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<form class="form-signin" role="form" method="post" action="{% url 'django.contrib.auth.views.login' %}">
|
|
||||||
<h2 class="form-signin-heading">Bitte melde dich an</h2>
|
|
||||||
{% csrf_token %}
|
|
||||||
<input class="form-control" type="text" autofocus="" required="" name="{{form.username.html_name}}" placeholder="Anmeldename" />
|
|
||||||
<input class="form-control" type="password" required="" placeholder="Passwort" name="{{form.password.html_name}}" />
|
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Anmelden</button>
|
|
||||||
<input type="hidden" name="next" value="{{ next }}" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -2,128 +2,114 @@
|
|||||||
{% load i18n static %}
|
{% load i18n static %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}javascript/tippy.js"></script>
|
<script type="text/javascript" src="{% static 'javascript/tippy.js' %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block nav %}
|
{% block nav %}
|
||||||
{% include "nav.html" with ls=ls season=season %}
|
{% include "nav.html" with ls=ls season=season %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div id="content-main">
|
<div id="content-main">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-7">
|
<div class="col-md-6">
|
||||||
<h2>Neueste Nachrichten</h2>
|
<h3>Deine Tipps</h3>
|
||||||
<p class="text-right">
|
<nav>
|
||||||
<a class="btn btn-default" href="/blog/1" role="button">zum Blog</a>
|
<ul class="pager">
|
||||||
</p>
|
<li data-toggle="tooltip" title="{% trans 'previous' %}" class="previous"><a
|
||||||
{% for post, avatar in posts %}
|
href="/matchday/{{ ls }}/{{ season }}/{{ cur_md|add:"-1"|stringformat:"02i" }}"><span
|
||||||
<div class="panel panel-default">
|
aria-hidden="true">←</span></a></li>
|
||||||
<div class="panel-heading">
|
{{ md_name }}
|
||||||
{{post.author.first_name}} schrieb {{post.created|naturaltime}}
|
<li data-toggle="tooltip" title="{% trans 'next' %}" class="next"><a
|
||||||
|
href="/matchday/{{ ls }}/{{ season }}/{{ cur_md|add:"1"|stringformat:"02i" }}"><span
|
||||||
|
aria-hidden="true">→</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<form role="form" action="" method="post">{% csrf_token %}
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover table-condensed">
|
||||||
|
<tr>
|
||||||
|
<th>Anstoß</th>
|
||||||
|
<th>Heim</th>
|
||||||
|
<th>Gast</th>
|
||||||
|
<th>Erg.</th>
|
||||||
|
<th colspan="2">Tipp</th>
|
||||||
|
</tr>
|
||||||
|
{% for match in matches %}
|
||||||
|
{% if match.started and not match.finished %}
|
||||||
|
<tr class="danger">{% else %}
|
||||||
|
<tr>{% endif %}
|
||||||
|
<td>{{ match.matchDateTime }}</td>
|
||||||
|
{% if match.iconURLTeam1 != "" %}
|
||||||
|
<td><img src="{{ match.iconURLTeam1 }}" width="20"/>
|
||||||
|
{% else %}
|
||||||
|
<td><img src="{{ STATIC_URL }}{{ match.iconTeam1 }}"/>
|
||||||
|
{% endif %}
|
||||||
|
<span class="hidden-xs"> {{ match.nameTeam1 }}</span>
|
||||||
|
<span class="visible-xs"> {{ match.abbrTeam1 }}</span>
|
||||||
|
</td>
|
||||||
|
{% if match.iconURLTeam1 != "" %}
|
||||||
|
<td><img src="{{ match.iconURLTeam2 }}" width="20"/>
|
||||||
|
{% else %}
|
||||||
|
<td><img src="{{ STATIC_URL }}{{ match.iconTeam2 }}"/>
|
||||||
|
{% endif %}
|
||||||
|
<span class="hidden-xs"> {{ match.nameTeam2 }}</span>
|
||||||
|
<span class="visible-xs"> {{ match.abbrTeam2 }}</span>
|
||||||
|
</td>
|
||||||
|
<td>{{ match.matchResult }}</td>
|
||||||
|
<td>{{ match.tippFormTeam1 }}</td>
|
||||||
|
<td>{{ match.tippFormTeam2 }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-default btn-lg btn-block">
|
||||||
|
<span class="glyphicon glyphicon-saved" aria-hidden="true"></span> Tipps abgeben
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% for mandant, list in mandant_dict.items %}
|
||||||
|
<h3>Mitspieler {{ mandant }}</h3>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover table-condensed">
|
||||||
|
<tr>
|
||||||
|
<th>Tipper</th>
|
||||||
|
<th>Gesamt</th>
|
||||||
|
{% for match in matches %}
|
||||||
|
<th>
|
||||||
|
{% if match.iconURLTeam1 != "" %}
|
||||||
|
<img src="{{ match.iconURLTeam1 }}" width="20"/>
|
||||||
|
{% else %}
|
||||||
|
<img src="{{ STATIC_URL }}{{ match.iconTeam1 }}"/>
|
||||||
|
{% endif %}
|
||||||
|
<br/><br/>
|
||||||
|
{% if match.iconURLTeam2 != "" %}
|
||||||
|
<img src="{{ match.iconURLTeam2 }}" width="20"/>
|
||||||
|
{% else %}
|
||||||
|
<img src="{{ STATIC_URL }}{{ match.iconTeam2 }}"/>
|
||||||
|
{% endif %}
|
||||||
|
</th>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% for mate in list %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ mate.mate.first_name }}</td>
|
||||||
|
<td>{{ mate.sum_score }}</td>
|
||||||
|
{% for tipp in mate.tipps %}
|
||||||
|
<td>{{ tipp }}</td>
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h3>Chat</h3>
|
||||||
|
{% block chat %}
|
||||||
|
{% include "chat.xhtml" with posts=posts %}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
|
||||||
{% if avatar %}
|
|
||||||
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic" src="/media/{{avatar}}" />
|
|
||||||
{% else %}
|
|
||||||
<img class="img-circle img-responsive pull-left blog" alt="Profile Pic" src="/media/profiles/dummy.png" />
|
|
||||||
{% endif %}
|
|
||||||
{{post.content|safe}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-7">
|
|
||||||
<h2>Deine Tipps</h2>
|
|
||||||
<nav>
|
|
||||||
<ul class="pager">
|
|
||||||
<li data-toggle="tooltip" title="{% trans 'previous' %}" class="previous"><a href="/matchday/{{ ls }}/{{ season }}/{{ cur_md|add:"-1"|stringformat:"02i" }}"><span aria-hidden="true">←</span></a></li>
|
|
||||||
{{ md_name }}
|
|
||||||
<li data-toggle="tooltip" title="{% trans 'next' %}" class="next"><a href="/matchday/{{ ls }}/{{ season }}/{{ cur_md|add:"1"|stringformat:"02i" }}"><span aria-hidden="true">→</span></a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<form role="form" action="" method="post">{% csrf_token %}
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-hover table-condensed">
|
|
||||||
<tr>
|
|
||||||
<th>Anstoß</th>
|
|
||||||
<th>Heim</th>
|
|
||||||
<th>Gast</th>
|
|
||||||
<th>Erg.</th>
|
|
||||||
<th colspan="2">Tipp</th>
|
|
||||||
</tr>
|
|
||||||
{% for match in matches %}
|
|
||||||
{% if match.started and not match.finished %}
|
|
||||||
<tr class="danger">{% else %}<tr>{% endif %}
|
|
||||||
<td>{{ match.matchDateTime }}</td>
|
|
||||||
{% if match.iconURLTeam1 != "" %}
|
|
||||||
<td><img src="{{ match.iconURLTeam1 }}" width="20"/>
|
|
||||||
{% else %}
|
|
||||||
<td><img src="{{ STATIC_URL}}{{ match.iconTeam1 }}" />
|
|
||||||
{% endif %}
|
|
||||||
<span class="hidden-xs"> {{ match.nameTeam1 }}</span>
|
|
||||||
<span class="visible-xs"> {{ match.abbrTeam1 }}</span>
|
|
||||||
</td>
|
|
||||||
{% if match.iconURLTeam1 != "" %}
|
|
||||||
<td><img src="{{ match.iconURLTeam2 }}" width="20"/>
|
|
||||||
{% else %}
|
|
||||||
<td><img src="{{ STATIC_URL}}{{ match.iconTeam2 }}" />
|
|
||||||
{% endif %}
|
|
||||||
<span class="hidden-xs"> {{ match.nameTeam2 }}</span>
|
|
||||||
<span class="visible-xs"> {{ match.abbrTeam2 }}</span>
|
|
||||||
</td>
|
|
||||||
<td>{{ match.matchResult }}</td>
|
|
||||||
<td>{{ match.tippFormTeam1 }}</td><td>{{ match.tippFormTeam2 }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-default btn-lg btn-block">
|
|
||||||
<span class="glyphicon glyphicon-saved" aria-hidden="true"></span> Tipps abgeben
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
{% for mandant, list in mandant_dict.items %}
|
|
||||||
<div class="col-md-7">
|
|
||||||
<h4>Mitspieler {{ mandant }}</h4>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-hover table-condensed">
|
|
||||||
<tr>
|
|
||||||
<th>Tipper</th>
|
|
||||||
<th>Gesamt</th>
|
|
||||||
{% for match in matches %}
|
|
||||||
<th>
|
|
||||||
{% if match.iconURLTeam1 != "" %}
|
|
||||||
<img src="{{ match.iconURLTeam1 }}" width="20"/>
|
|
||||||
{% else %}
|
|
||||||
<img src="{{ STATIC_URL }}{{ match.iconTeam1 }}" />
|
|
||||||
{% endif %}
|
|
||||||
<br /><br />
|
|
||||||
{% if match.iconURLTeam2 != "" %}
|
|
||||||
<img src="{{ match.iconURLTeam2 }}" width="20"/>
|
|
||||||
{% else %}
|
|
||||||
<img src="{{ STATIC_URL }}{{ match.iconTeam2 }}" />
|
|
||||||
{% endif %}
|
|
||||||
</th>
|
|
||||||
{% endfor %}
|
|
||||||
</tr>
|
|
||||||
{% for mate in list %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ mate.mate.first_name }}</td>
|
|
||||||
<td>{{ mate.sum_score }}</td>
|
|
||||||
{% for tipp in mate.tipps %}
|
|
||||||
<td>{{ tipp }}</td>
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -16,6 +16,9 @@
|
|||||||
<li><a href="/">Tipps</a></li>
|
<li><a href="/">Tipps</a></li>
|
||||||
<li><a href="/charts/{{ ls }}/{{ season }}{% if pos %}/{{ pos }}{% endif %}">Bestenliste</a></li>
|
<li><a href="/charts/{{ ls }}/{{ season }}{% if pos %}/{{ pos }}{% endif %}">Bestenliste</a></li>
|
||||||
<li><a href="/blog/1">Blog</a></li>
|
<li><a href="/blog/1">Blog</a></li>
|
||||||
|
{% if request.user.is_active and request.user.is_staff %}
|
||||||
|
<li><a href="/staff">Staff</a></li>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
{% if has_refresh %}
|
{% if has_refresh %}
|
||||||
@@ -32,7 +35,7 @@
|
|||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="/accounts/profile/{{user.id}}">Profil ändern</a></li>
|
<li><a href="/accounts/profile/{{user.id}}">Profil ändern</a></li>
|
||||||
<li><a href="/accounts/password_change/">Passwort ändern</a></li>
|
<li><a href="/accounts/password_change/">Passwort ändern</a></li>
|
||||||
<li><a href="/logout">Abmelden</a></li>
|
<li><a href="/accounts/logout">Abmelden</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,58 +1,58 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load i18n static %}
|
{% load i18n static %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<title> TipPy Blog</title>
|
<title> TipPy Blog</title>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block nav %}
|
{% block nav %}
|
||||||
{% include "nav.html" with ls=ls season=season %}
|
{% include "nav.html" with ls=ls season=season %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div id="content-main">
|
<div id="content-main">
|
||||||
{% if form_bp.errors %}
|
{% if form_bp.errors %}
|
||||||
<div>
|
<div>
|
||||||
<p class="errornote">
|
<p class="errornote">
|
||||||
{% if form_bp.errors.items|length == 1 %}
|
{% if form_bp.errors.items|length == 1 %}
|
||||||
{% trans "Please correct the error below." %}
|
{% trans "Please correct the error below." %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans "Please correct the errors below." %}
|
{% trans "Please correct the errors below." %}
|
||||||
{% endif %}</p>
|
{% endif %}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<form class="form-horizontal" action="" method="post">{% csrf_token %}
|
<form class="form-horizontal" action="" method="post">{% csrf_token %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{form_bp.content.errors}}
|
{{ form_bp.content.errors }}
|
||||||
<label for="id_content" class="col-sm-4 control-label required">{% trans 'Content' %}</label>
|
<div class="col-sm-5">
|
||||||
<div class="col-sm-5">
|
<div class="panel-body">
|
||||||
<textarea class="form-control" maxlength="256" rows="2"
|
<textarea class="form-control" placeholder="Schreibe einen Kommentar..." id="id_content"
|
||||||
id="id_content" name="content"></textarea>
|
name="content" maxlength="100" rows="2"></textarea>
|
||||||
{% if cnt_mandants > 1 %}
|
{% if cnt_mandants > 1 %}
|
||||||
{{ form_mandants.mandants.label_tag }}
|
{{ form_mandants.mandants.label_tag }}
|
||||||
{% for choice in form_mandants.mandants %}
|
{% for choice in form_mandants.mandants %}
|
||||||
<label for="{{choice.id_for_label}}">
|
<label for="{{ choice.id_for_label }}">
|
||||||
{{ choice.tag }} {{choice.choice_label}}
|
{{ choice.tag }} {{ choice.choice_label }}
|
||||||
</label>
|
</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<button type="submit" class="btn btn-default">{% trans 'Sent' %}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
{% if debug %}
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
<div class="row">
|
||||||
<button type="submit" class="btn btn-default">{% trans 'Sent' %}</button>
|
<div class="col-md-8">
|
||||||
</div>
|
<p>{{ debug }}</p>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% if debug %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-8">
|
|
||||||
<p>{{ debug }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load url from future %}
|
{% load admin_urls %}
|
||||||
|
|
||||||
{% comment %}
|
{% comment %}
|
||||||
Main page to authenticate users.
|
Main page to authenticate users.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<form class="form-signin" role="form" method="post" action="{% url 'django.contrib.auth.views.login' %}">
|
<form class="form-signin" role="form" method="post" action="{% url 'login' %}">
|
||||||
<h2 class="form-signin-heading">Bitte melde dich an</h2>
|
<h2 class="form-signin-heading">Bitte melde dich an</h2>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input class="form-control" type="text" autofocus="" required="" name="{{form.username.html_name}}" placeholder="Anmeldename" />
|
<input class="form-control" type="text" autofocus="" required="" name="{{form.username.html_name}}" placeholder="Anmeldename" />
|
||||||
|
|||||||
34
templates/staff.html
Normal file
34
templates/staff.html
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load i18n static %}
|
||||||
|
{% load humanize %}
|
||||||
|
{% block head %}
|
||||||
|
<script type="text/javascript" src="{% static 'javascript/tippy.js' %}"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block nav %}
|
||||||
|
{% include "nav.html" with ls=ls season=season %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div id="content-main">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h3>Wettbewerbe</h3>
|
||||||
|
{% for comp in competitions %}
|
||||||
|
{{ comp }}<br/>
|
||||||
|
{% endfor %}
|
||||||
|
<h3></h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if debug %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h2 class="form-signin-heading">{% trans 'Debug' %}</h2>
|
||||||
|
{% for line in debug %}
|
||||||
|
<p>{{ line }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
146
tipp/migrations/0001_initial.py
Normal file
146
tipp/migrations/0001_initial.py
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
# Generated by Django 4.0.6 on 2022-07-14 15:15
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Competition',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('leagueShortcut', models.CharField(max_length=32)),
|
||||||
|
('leagueName', models.CharField(max_length=128)),
|
||||||
|
('season', models.CharField(max_length=4)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Mandant',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=32, unique=True)),
|
||||||
|
('description', models.CharField(max_length=255)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Post',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('content', models.TextField()),
|
||||||
|
('published', models.BooleanField(default=True)),
|
||||||
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['-created'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Team',
|
||||||
|
fields=[
|
||||||
|
('teamID', models.IntegerField(primary_key=True, serialize=False, unique=True)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('icon', models.FileField(upload_to='images/team_logos/')),
|
||||||
|
('abbr', models.CharField(max_length=3)),
|
||||||
|
('iconURL', models.CharField(max_length=2000)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'managed': True,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='UserProfile',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('avatar', models.ImageField(blank=True, upload_to='profiles/')),
|
||||||
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Score',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('exact_high', models.PositiveSmallIntegerField()),
|
||||||
|
('exact', models.PositiveSmallIntegerField()),
|
||||||
|
('diff', models.PositiveSmallIntegerField()),
|
||||||
|
('tendency', models.PositiveSmallIntegerField()),
|
||||||
|
('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tipp.mandant')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Match',
|
||||||
|
fields=[
|
||||||
|
('matchID', models.IntegerField(primary_key=True, serialize=False, unique=True)),
|
||||||
|
('matchDateTime', models.DateTimeField()),
|
||||||
|
('group', models.IntegerField()),
|
||||||
|
('matchday', models.IntegerField()),
|
||||||
|
('matchday_name', models.CharField(max_length=128)),
|
||||||
|
('pointsTeam1', models.SmallIntegerField()),
|
||||||
|
('pointsTeam2', models.SmallIntegerField()),
|
||||||
|
('finished', models.BooleanField()),
|
||||||
|
('season', models.CharField(max_length=4)),
|
||||||
|
('leagueShortcut', models.CharField(max_length=12)),
|
||||||
|
('idTeam1', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='tipp.team')),
|
||||||
|
('idTeam2', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='tipp.team')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Tipp',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('pointsTeam1', models.PositiveSmallIntegerField()),
|
||||||
|
('pointsTeam2', models.PositiveSmallIntegerField()),
|
||||||
|
('score', models.PositiveIntegerField(blank=True, null=True)),
|
||||||
|
('matchID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tipp.match')),
|
||||||
|
('tipperID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'unique_together': {('matchID', 'tipperID')},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='RelUserMandant',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('mandant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tipp.mandant')),
|
||||||
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'unique_together': {('user', 'mandant')},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='RelPostMandant',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('mandant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tipp.mandant')),
|
||||||
|
('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tipp.post')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'unique_together': {('post', 'mandant')},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='chart',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('points', models.PositiveSmallIntegerField()),
|
||||||
|
('diff', models.SmallIntegerField()),
|
||||||
|
('games', models.PositiveSmallIntegerField()),
|
||||||
|
('competition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tipp.competition')),
|
||||||
|
('team', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tipp.team')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'unique_together': {('team', 'competition')},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
0
tipp/migrations/__init__.py
Normal file
0
tipp/migrations/__init__.py
Normal file
100
tipp/models.py
100
tipp/models.py
@@ -17,25 +17,29 @@ GNU General Public License for more details.
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with TipPy. If not, see <http://www.gnu.org/licenses/>.
|
along with TipPy. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.db import models
|
|
||||||
from django.core.urlresolvers import reverse
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
class UserProfile(models.Model):
|
class UserProfile(models.Model):
|
||||||
user = models.OneToOneField(User)
|
user = models.OneToOneField(
|
||||||
|
User,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
avatar = models.ImageField(upload_to="profiles/", blank=True)
|
avatar = models.ImageField(upload_to="profiles/", blank=True)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.user.username
|
return self.user.username
|
||||||
|
|
||||||
|
|
||||||
class Competition(models.Model):
|
class Competition(models.Model):
|
||||||
leagueShortcut = models.CharField(max_length=32)
|
leagueShortcut = models.CharField(max_length=32)
|
||||||
leagueName = models.CharField(max_length=128)
|
leagueName = models.CharField(max_length=128)
|
||||||
season = models.CharField(max_length=4)
|
season = models.CharField(max_length=4)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return(self.leagueShortcut)
|
return (self.leagueShortcut)
|
||||||
|
|
||||||
|
|
||||||
class Team(models.Model):
|
class Team(models.Model):
|
||||||
teamID = models.IntegerField(unique=True, primary_key=True)
|
teamID = models.IntegerField(unique=True, primary_key=True)
|
||||||
@@ -48,18 +52,24 @@ class Team(models.Model):
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = True
|
managed = True
|
||||||
app_label = 'tipp'
|
app_label = 'tipp'
|
||||||
|
|
||||||
|
|
||||||
class Match(models.Model):
|
class Match(models.Model):
|
||||||
matchID = models.IntegerField(unique=True,primary_key=True)
|
matchID = models.IntegerField(unique=True, primary_key=True)
|
||||||
matchDateTime = models.DateTimeField()
|
matchDateTime = models.DateTimeField()
|
||||||
group = models.IntegerField()
|
group = models.IntegerField()
|
||||||
matchday = models.IntegerField()
|
matchday = models.IntegerField()
|
||||||
matchday_name = models.CharField(max_length=128)
|
matchday_name = models.CharField(max_length=128)
|
||||||
idTeam1 = models.ForeignKey(Team, related_name='+')
|
idTeam1 = models.ForeignKey(
|
||||||
idTeam2 = models.ForeignKey(Team, related_name='+')
|
Team, related_name='+',
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
idTeam2 = models.ForeignKey(
|
||||||
|
Team, related_name='+',
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
pointsTeam1 = models.SmallIntegerField()
|
pointsTeam1 = models.SmallIntegerField()
|
||||||
pointsTeam2 = models.SmallIntegerField()
|
pointsTeam2 = models.SmallIntegerField()
|
||||||
finished = models.BooleanField()
|
finished = models.BooleanField()
|
||||||
@@ -69,9 +79,16 @@ class Match(models.Model):
|
|||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return (str(self.matchID))
|
return (str(self.matchID))
|
||||||
|
|
||||||
|
|
||||||
class Tipp(models.Model):
|
class Tipp(models.Model):
|
||||||
matchID = models.ForeignKey(Match)
|
matchID = models.ForeignKey(
|
||||||
tipperID = models.ForeignKey(User)
|
Match,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
tipperID = models.ForeignKey(
|
||||||
|
User,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
pointsTeam1 = models.PositiveSmallIntegerField()
|
pointsTeam1 = models.PositiveSmallIntegerField()
|
||||||
pointsTeam2 = models.PositiveSmallIntegerField()
|
pointsTeam2 = models.PositiveSmallIntegerField()
|
||||||
score = models.PositiveIntegerField(
|
score = models.PositiveIntegerField(
|
||||||
@@ -81,58 +98,91 @@ class Tipp(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ("matchID", "tipperID")
|
unique_together = ("matchID", "tipperID")
|
||||||
|
|
||||||
|
|
||||||
class Mandant(models.Model):
|
class Mandant(models.Model):
|
||||||
name = models.CharField(max_length=32, unique=True)
|
name = models.CharField(max_length=32, unique=True)
|
||||||
description = models.CharField(max_length=255)
|
description = models.CharField(max_length=255)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
class Score(models.Model):
|
class Score(models.Model):
|
||||||
client = models.ForeignKey(Mandant)
|
client = models.ForeignKey(
|
||||||
|
Mandant,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
exact_high = models.PositiveSmallIntegerField()
|
exact_high = models.PositiveSmallIntegerField()
|
||||||
exact = models.PositiveSmallIntegerField()
|
exact = models.PositiveSmallIntegerField()
|
||||||
diff = models.PositiveSmallIntegerField()
|
diff = models.PositiveSmallIntegerField()
|
||||||
tendency = models.PositiveSmallIntegerField()
|
tendency = models.PositiveSmallIntegerField()
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return str(self.client)
|
return str(self.client)
|
||||||
|
|
||||||
|
|
||||||
class chart(models.Model):
|
class chart(models.Model):
|
||||||
team = models.ForeignKey(Team)
|
team = models.ForeignKey(
|
||||||
competition = models.ForeignKey(Competition)
|
Team,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
competition = models.ForeignKey(
|
||||||
|
Competition,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
points = models.PositiveSmallIntegerField()
|
points = models.PositiveSmallIntegerField()
|
||||||
diff = models.SmallIntegerField()
|
diff = models.SmallIntegerField()
|
||||||
games = models.PositiveSmallIntegerField()
|
games = models.PositiveSmallIntegerField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ("team", "competition")
|
unique_together = ("team", "competition")
|
||||||
|
|
||||||
|
|
||||||
class RelUserMandant(models.Model):
|
class RelUserMandant(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(
|
||||||
mandant = models.ForeignKey(Mandant)
|
User,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
mandant = models.ForeignKey(
|
||||||
|
Mandant,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ("user", "mandant")
|
unique_together = ("user", "mandant")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return (str(self.user) + " -> " + str(self.mandant))
|
return (str(self.user) + " -> " + str(self.mandant))
|
||||||
|
|
||||||
|
|
||||||
class Post(models.Model):
|
class Post(models.Model):
|
||||||
content = models.TextField()
|
content = models.TextField()
|
||||||
published = models.BooleanField(default=True)
|
published = models.BooleanField(default=True)
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
author = models.ForeignKey(User)
|
author = models.ForeignKey(
|
||||||
|
User,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['-created']
|
ordering = ['-created']
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u'%s' % self.created
|
return u'%s' % self.created
|
||||||
|
|
||||||
|
|
||||||
class RelPostMandant(models.Model):
|
class RelPostMandant(models.Model):
|
||||||
post = models.ForeignKey(Post)
|
post = models.ForeignKey(
|
||||||
mandant = models.ForeignKey(Mandant)
|
Post,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
mandant = models.ForeignKey(
|
||||||
|
Mandant,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ("post", "mandant")
|
unique_together = ("post", "mandant")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return (str(self.post) + " -> " + str(self.mandant))
|
return (str(self.post) + " -> " + str(self.mandant))
|
||||||
|
|
||||||
|
|||||||
@@ -18,50 +18,56 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with TipPy. If not, see <http://www.gnu.org/licenses/>.
|
# along with TipPy. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
import sys, locale, suds, urllib2, psycopg2
|
import locale
|
||||||
|
import urllib.error
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
|
from suds.client import Client
|
||||||
|
|
||||||
|
|
||||||
class OpenLiga(object):
|
class OpenLiga(object):
|
||||||
version = "0.1"
|
version = "0.1"
|
||||||
error = ""
|
error = ""
|
||||||
proxyurl = None
|
proxyurl = None
|
||||||
debug = None
|
debug = None
|
||||||
client = None
|
client = None
|
||||||
|
|
||||||
def __init__(self, proxyurl=None, debug=False):
|
def __init__(self, proxyurl=None, debug=False):
|
||||||
|
|
||||||
# set locale to environment (for dispaying localized dates)
|
# set locale to environment (for dispaying localized dates)
|
||||||
locale.setlocale(locale.LC_TIME, "")
|
locale.setlocale(locale.LC_TIME, "")
|
||||||
|
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
|
||||||
# get a SUDS client object
|
# get a SUDS client object
|
||||||
if self.proxyurl is None:
|
if self.proxyurl is None:
|
||||||
try:
|
try:
|
||||||
self.client = suds.client.Client(
|
self.client = Client(
|
||||||
'http://www.openligadb.de/'
|
'http://www.openligadb.de/'
|
||||||
+ 'Webservices/Sportsdata.asmx?WSDL')
|
+ 'Webservices/Sportsdata.asmx?WSDL')
|
||||||
except (urllib2.URLError):
|
except (urllib.error.URLError):
|
||||||
self.error += "Connect to webservice failed."
|
self.error += "Connect to webservice failed."
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
t = suds.transport.http.HttpTransport()
|
t = suds.transport.http.HttpTransport()
|
||||||
proxy = urllib2.ProxyHandler({'http':proxyurl})
|
proxy = urllib.request.ProxyHandler({'http': proxyurl})
|
||||||
opener = urllib2.build_opener(proxy)
|
opener = urllib.request.build_opener(proxy)
|
||||||
t.urlopener = opener
|
t.urlopener = opener
|
||||||
self.client = suds.client.Client(
|
self.client = suds.client.Client(
|
||||||
'http://www.openligadb.de/Webservices/'
|
'http://www.openligadb.de/Webservices/'
|
||||||
+ 'Sportsdata.asmx?WSDL', transport=t)
|
+ 'Sportsdata.asmx?WSDL', transport=t)
|
||||||
except urllib2.URLError as e:
|
except urllib.error.URLError as e:
|
||||||
self.error += "Connect to webservice failed " \
|
self.error += "Connect to webservice failed " \
|
||||||
+ "(via proxy " + proxyurl + "): " + str(e) + "\n"
|
+ "(via proxy " + proxyurl + "): " + str(e) + "\n"
|
||||||
|
|
||||||
def getSeason(self, season, league='bl1'):
|
def getSeason(self, season, league='bl1'):
|
||||||
""" Get the whole season.
|
""" Get the whole season.
|
||||||
|
|
||||||
Args: season and league shortcut (optional)
|
Args: season and league shortcut (optional)
|
||||||
"""
|
"""
|
||||||
return(self.client.service.GetMatchdataByLeagueSaison(
|
return (self.client.service.GetMatchdataByLeagueSaison(
|
||||||
leagueShortcut=league,leagueSaison=season)
|
leagueShortcut=league, leagueSaison=season)
|
||||||
)
|
)
|
||||||
|
|
||||||
def getMatchday(self, season, matchdaynumber, league='bl1'):
|
def getMatchday(self, season, matchdaynumber, league='bl1'):
|
||||||
@@ -69,22 +75,19 @@ class OpenLiga(object):
|
|||||||
|
|
||||||
Args: season, matchdaynumber and league shortcut (optional)
|
Args: season, matchdaynumber and league shortcut (optional)
|
||||||
"""
|
"""
|
||||||
return(self.client.service.GetMatchdataByGroupLeagueSaison(
|
return (self.client.service.GetMatchdataByGroupLeagueSaison(
|
||||||
groupOrderID=matchdaynumber,
|
groupOrderID=matchdaynumber,
|
||||||
leagueShortcut=league,
|
leagueShortcut=league,
|
||||||
leagueSaison=season)
|
leagueSaison=season)
|
||||||
)
|
)
|
||||||
|
|
||||||
def getTeams(self, season, league='bl1'):
|
def getTeams(self, season, league='bl1'):
|
||||||
return(self.client.service.GetTeamsByLeagueSaison(
|
return (self.client.service.GetTeamsByLeagueSaison(
|
||||||
leagueShortcut=league,
|
leagueShortcut=league,
|
||||||
leagueSaison=season)
|
leagueSaison=season)
|
||||||
)
|
)
|
||||||
|
|
||||||
def getCurrentGroup(self, league):
|
def getCurrentGroup(self, league):
|
||||||
return(self.client.service.GetCurrentGroup(
|
return (self.client.service.GetCurrentGroup(
|
||||||
leagueShortcut=league)
|
leagueShortcut=league)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
33
tipp/urls.py
Normal file
33
tipp/urls.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
from django.contrib.auth import views as auth_views
|
||||||
|
from django.urls import re_path
|
||||||
|
from django.conf.urls import include
|
||||||
|
from django.conf import settings
|
||||||
|
from django.conf.urls.static import static
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
re_path(r'^$', views.home, name='home'),
|
||||||
|
re_path(r'^getSeason/(?P<ls>.*)/(?P<season>\d{4})$',
|
||||||
|
views.getSeason),
|
||||||
|
re_path(r'^update/(?P<ls>.*)/(?P<season>\d{4})/(?P<cur_md>\d{2})$',
|
||||||
|
views.update, name='update'),
|
||||||
|
re_path(r'^matchday/(?P<ls>.{3,})/(?P<season>\d{4})/(?P<matchday>\d{2})$',
|
||||||
|
views.matchday, name='matchday'),
|
||||||
|
re_path(r'^charts/(?P<ls>\w{3,})/(?P<season>\d{4})$', views.charts,
|
||||||
|
name='charts'),
|
||||||
|
re_path(r'^charts/(?P<ls>\w{3,})/(?P<season>\d{4})/(?P<pos>\w{1,})$',
|
||||||
|
views.charts, name='charts'),
|
||||||
|
re_path(r'^accounts/profile/(\d+)', views.profile),
|
||||||
|
re_path(r'^accounts/', include('django.contrib.auth.urls')),
|
||||||
|
re_path(r'^blog/newpost$', views.newBlogpost),
|
||||||
|
re_path(r'^blog/(?P<page>\d)$', views.blogindex),
|
||||||
|
re_path(r'^about$', views.about),
|
||||||
|
re_path(r'^staff', views.staff),
|
||||||
|
re_path(r'^accounts/login/', auth_views.LoginView.as_view()),
|
||||||
|
re_path(r'^accounts/logout/', auth_views.LogoutView.as_view())
|
||||||
|
]
|
||||||
|
# Redirect on logout
|
||||||
|
LOGOUT_REDIRECT_URL = "home"
|
||||||
|
if settings.DEBUG is True:
|
||||||
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
428
tipp/views.py
428
tipp/views.py
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Copyright (c) 2015-2016 by Martin Bley (martin@mb-oss.de)
|
Copyright (c) 2015-2016 by Martin Bley (dev@mb-oss.de)
|
||||||
|
|
||||||
This file is part of TipPy.
|
This file is part of TipPy.
|
||||||
|
|
||||||
@@ -17,41 +17,32 @@ GNU General Public License for more details.
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with TipPy. If not, see <http://www.gnu.org/licenses/>.
|
along with TipPy. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.http import HttpResponse
|
import os
|
||||||
from django.shortcuts import render_to_response, redirect, render, \
|
|
||||||
get_object_or_404
|
|
||||||
from django.contrib.auth import authenticate, login
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.contrib.auth.decorators import login_required
|
|
||||||
from django.contrib.auth.views import password_reset, \
|
|
||||||
password_reset_confirm
|
|
||||||
from django.core.context_processors import csrf
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
|
||||||
from django.core.urlresolvers import reverse
|
|
||||||
from django.core.paginator import Paginator, InvalidPage, EmptyPage, \
|
|
||||||
PageNotAnInteger
|
|
||||||
from django.utils import timezone
|
|
||||||
from django.utils.text import slugify
|
|
||||||
from django.db.models import Sum, Max
|
|
||||||
from django.conf import settings
|
|
||||||
from os.path import join as pjoin
|
from os.path import join as pjoin
|
||||||
from tipp.models import *
|
|
||||||
from tipp.forms import *
|
|
||||||
from openliga import *
|
|
||||||
from datetime import datetime
|
|
||||||
from PIL import Image as PImage
|
|
||||||
import urllib2, pytz, os, sys
|
|
||||||
|
|
||||||
# setting utf-8 as default encoding to avoid errors in file
|
import django.shortcuts
|
||||||
# uploads and form data
|
import pytz
|
||||||
reload(sys)
|
from PIL import Image as PImage
|
||||||
sys.setdefaultencoding('utf8')
|
from django.conf import settings
|
||||||
|
from django.contrib.admin.views.decorators import staff_member_required
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
from django.core.paginator import Paginator, EmptyPage, \
|
||||||
|
PageNotAnInteger
|
||||||
|
from django.db.models import Sum
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from tipp.forms import *
|
||||||
|
from tipp.models import *
|
||||||
|
from tipp.openliga import *
|
||||||
|
|
||||||
timezoneLocal = pytz.timezone('Europe/Berlin')
|
timezoneLocal = pytz.timezone('Europe/Berlin')
|
||||||
|
|
||||||
|
|
||||||
def about(request):
|
def about(request):
|
||||||
return render(request, 'about.html')
|
return django.shortcuts.render(request, 'about.html')
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@@ -60,11 +51,12 @@ def home(request):
|
|||||||
season = get_current_season()
|
season = get_current_season()
|
||||||
md = get_current_md(ls)
|
md = get_current_md(ls)
|
||||||
|
|
||||||
return redirect("matchday",
|
return django.shortcuts.redirect("matchday",
|
||||||
ls = ls,
|
ls=ls,
|
||||||
season = season,
|
season=season,
|
||||||
matchday=str(md).zfill(2)
|
matchday=str(md).zfill(2)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def profile(request, pk):
|
def profile(request, pk):
|
||||||
@@ -75,7 +67,7 @@ def profile(request, pk):
|
|||||||
img = profile.avatar.name
|
img = profile.avatar.name
|
||||||
else:
|
else:
|
||||||
img = None
|
img = None
|
||||||
|
|
||||||
debug = []
|
debug = []
|
||||||
debug.append('avatar: ' + str(img))
|
debug.append('avatar: ' + str(img))
|
||||||
|
|
||||||
@@ -87,7 +79,7 @@ def profile(request, pk):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if user_form.is_valid() and profile_form.is_valid():
|
if user_form.is_valid() and profile_form.is_valid():
|
||||||
|
|
||||||
user = user_form.save()
|
user = user_form.save()
|
||||||
|
|
||||||
profile = profile_form.save(commit=False)
|
profile = profile_form.save(commit=False)
|
||||||
@@ -102,64 +94,74 @@ def profile(request, pk):
|
|||||||
# create thumbnail
|
# create thumbnail
|
||||||
imfn = pjoin(settings.MEDIA_ROOT, profile.avatar.name)
|
imfn = pjoin(settings.MEDIA_ROOT, profile.avatar.name)
|
||||||
im = PImage.open(imfn)
|
im = PImage.open(imfn)
|
||||||
im.thumbnail((50,50), PImage.ANTIALIAS)
|
im.thumbnail((50, 50), PImage.ANTIALIAS)
|
||||||
im.save(settings.MEDIA_ROOT + profile.avatar.name)
|
im.save(settings.MEDIA_ROOT + profile.avatar.name)
|
||||||
if 'avatar-clear' in request.POST:
|
if 'avatar-clear' in request.POST:
|
||||||
if 'on' in request.POST['avatar-clear']:
|
if 'on' in request.POST['avatar-clear']:
|
||||||
image = pjoin(settings.MEDIA_ROOT, img)
|
image = pjoin(settings.MEDIA_ROOT, img)
|
||||||
debug.append('Is the image ' + str(image)
|
debug.append('Is the image ' + str(image)
|
||||||
+ ' a regular file? '
|
+ ' a regular file? '
|
||||||
+ str(os.path.isfile(image))
|
+ str(os.path.isfile(image))
|
||||||
)
|
)
|
||||||
if os.path.isfile(image):
|
if os.path.isfile(image):
|
||||||
os.remove(image)
|
os.remove(image)
|
||||||
profile.save()
|
profile.save()
|
||||||
|
|
||||||
for item in request.POST:
|
for item in request.POST:
|
||||||
debug.append(str(item) + " -> "
|
debug.append(str(item) + " -> "
|
||||||
+ str(request.POST[item])
|
+ str(request.POST[item])
|
||||||
)
|
)
|
||||||
|
|
||||||
# Invalid form or forms - mistakes or something else?
|
# Invalid form or forms - mistakes or something else?
|
||||||
# Print problems to the terminal.
|
# Print problems to the terminal.
|
||||||
# They'll also be shown to the user.
|
# They'll also be shown to the user.
|
||||||
else:
|
else:
|
||||||
print user_form.errors, profile_form.errors
|
print(
|
||||||
|
user_form.errors,
|
||||||
|
profile_form.errors
|
||||||
|
)
|
||||||
|
|
||||||
return redirect( '/accounts/profile/' + str(user.id) )
|
return django.shortcuts.redirect('/accounts/profile/' + str(user.id))
|
||||||
|
|
||||||
# Not a HTTP POST, so we render our form using two ModelForm
|
# Not a HTTP POST, so we render our form using two ModelForm
|
||||||
# instances. These forms will be blank, ready for user input.
|
# instances. These forms will be blank, ready for user input.
|
||||||
else:
|
else:
|
||||||
user_form = UserForm(
|
user_form = UserForm(
|
||||||
initial={ 'last_name': user.last_name,
|
initial={'last_name': user.last_name,
|
||||||
'first_name': user.first_name,
|
'first_name': user.first_name,
|
||||||
'email': user.email },
|
'email': user.email},
|
||||||
instance=user
|
instance=user
|
||||||
)
|
)
|
||||||
profile_form = UserProfileForm(instance=profile)
|
profile_form = UserProfileForm(instance=profile)
|
||||||
|
|
||||||
return render(request, 'registration/profile.html', {
|
return django.shortcuts.render(request, 'registration/profile.html', {
|
||||||
'user_form': user_form,
|
'user_form': user_form,
|
||||||
'profile_form': profile_form,
|
'profile_form': profile_form,
|
||||||
'debug': debug,
|
'debug': debug,
|
||||||
'img': img}
|
'img': img}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staff_member_required
|
||||||
|
def staff(request):
|
||||||
|
season = get_current_season(),
|
||||||
|
""" get available competitions """
|
||||||
|
competitions = Competition.objects.filter(season=season).order_by('leagueName')
|
||||||
|
|
||||||
|
return django.shortcuts.render(request, 'staff.html', {'competitions': competitions})
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@staff_member_required
|
||||||
def getSeason(request, ls, season):
|
def getSeason(request, ls, season):
|
||||||
ol = OpenLiga()
|
ol = OpenLiga()
|
||||||
teams = ol.getTeams(str(season), ls)
|
teams = ol.getTeams(str(season), ls)
|
||||||
season = ol.getSeason(str(season), ls)
|
season = ol.getSeason(str(season), ls)
|
||||||
md = get_current_md(ls)
|
|
||||||
|
|
||||||
return_vals = []
|
return_vals = []
|
||||||
for team in teams[0]:
|
for team in teams[0]:
|
||||||
t = Team(
|
t = Team(
|
||||||
teamID=team['teamID'],
|
teamID=team['teamID'],
|
||||||
name=team['teamName'],
|
name=team['teamName'],
|
||||||
iconURL = team['teamIconURL']
|
iconURL=team['teamIconURL']
|
||||||
)
|
)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -167,36 +169,34 @@ def getSeason(request, ls, season):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
to = Team.objects.get(teamID=int(t.teamID))
|
to = Team.objects.get(teamID=int(t.teamID))
|
||||||
|
if to.iconURL is None:
|
||||||
|
t.save(update_fields=['iconURL'])
|
||||||
except Team.DoesNotExist:
|
except Team.DoesNotExist:
|
||||||
t.save()
|
t.save()
|
||||||
|
|
||||||
if to.iconURL is None:
|
|
||||||
t.save(update_fields=['iconURL'])
|
|
||||||
|
|
||||||
|
|
||||||
for match in season[0]:
|
for match in season[0]:
|
||||||
m = Match(matchID=unicode(match['matchID']),
|
m = Match(matchID=match['matchID'],
|
||||||
matchDateTime=datetime.strptime(
|
matchDateTime=match['matchDateTime'],
|
||||||
unicode(match['matchDateTime']), '%Y-%m-%d %H:%M:%S'),
|
group=int(match['groupID']),
|
||||||
group=int(match['groupID']),
|
matchday=int(match['groupOrderID']),
|
||||||
matchday=int(match['groupOrderID']),
|
matchday_name=match['groupName'],
|
||||||
matchday_name=unicode(match['groupName']),
|
idTeam1=Team.objects.get(teamID=int(match['idTeam1'])),
|
||||||
idTeam1=Team.objects.get(teamID=int(match['idTeam1'])),
|
idTeam2=Team.objects.get(teamID=int(match['idTeam2'])),
|
||||||
idTeam2=Team.objects.get(teamID=int(match['idTeam2'])),
|
pointsTeam1=match['pointsTeam1'],
|
||||||
pointsTeam1=match['pointsTeam1'],
|
pointsTeam2=match['pointsTeam2'],
|
||||||
pointsTeam2=match['pointsTeam2'],
|
finished=bool(match['matchIsFinished']),
|
||||||
finished=bool(match['matchIsFinished']),
|
season=match['leagueSaison'],
|
||||||
season=match['leagueSaison'],
|
leagueShortcut=match['leagueShortcut']
|
||||||
leagueShortcut=match['leagueShortcut']
|
)
|
||||||
)
|
|
||||||
m.save()
|
m.save()
|
||||||
|
|
||||||
return redirect("matchday",
|
return django.shortcuts.redirect("matchday",
|
||||||
ls=ls,
|
ls=ls,
|
||||||
season=get_current_season(),
|
season=get_current_season(),
|
||||||
matchday=str(get_current_md(ls)).zfill(2)
|
matchday=str(get_current_md(ls)).zfill(2)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def update(request, ls, season, cur_md):
|
def update(request, ls, season, cur_md):
|
||||||
"""
|
"""
|
||||||
@@ -205,7 +205,7 @@ def update(request, ls, season, cur_md):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
ol = OpenLiga()
|
ol = OpenLiga()
|
||||||
md_matches = ol.getMatchday(str(season), int(cur_md) ,ls)
|
md_matches = ol.getMatchday(str(season), int(cur_md), ls)
|
||||||
|
|
||||||
# Achtung: DateTimeField prüfen
|
# Achtung: DateTimeField prüfen
|
||||||
for match in md_matches[0]:
|
for match in md_matches[0]:
|
||||||
@@ -214,40 +214,46 @@ def update(request, ls, season, cur_md):
|
|||||||
try:
|
try:
|
||||||
for result in matchResults[0]:
|
for result in matchResults[0]:
|
||||||
if result['resultName'] == "Halbzeit":
|
if result['resultName'] == "Halbzeit":
|
||||||
pointsTeam1=int(result['pointsTeam1'])
|
pointsTeam1 = int(result['pointsTeam1'])
|
||||||
pointsTeam2=int(result['pointsTeam2'])
|
pointsTeam2 = int(result['pointsTeam2'])
|
||||||
elif result['resultName'] == "Endergebnis":
|
elif result['resultName'] == "Endergebnis":
|
||||||
pointsTeam1=int(result['pointsTeam1'])
|
pointsTeam1 = int(result['pointsTeam1'])
|
||||||
pointsTeam2=int(result['pointsTeam2'])
|
pointsTeam2 = int(result['pointsTeam2'])
|
||||||
|
break
|
||||||
elif str(result['resultName']) == u"nach Verlängerung":
|
elif str(result['resultName']) == u"nach Verlängerung":
|
||||||
pointsTeam1=int(result['pointsTeam1'])
|
pointsTeam1 = int(result['pointsTeam1'])
|
||||||
pointsTeam2=int(result['pointsTeam2'])
|
pointsTeam2 = int(result['pointsTeam2'])
|
||||||
else:
|
else:
|
||||||
pointsTeam1=-1
|
pointsTeam1 = -1
|
||||||
pointsTeam2=-1
|
pointsTeam2 = -1
|
||||||
|
|
||||||
except:
|
except:
|
||||||
pointsTeam1=-1
|
pointsTeam1 = -1
|
||||||
pointsTeam2=-1
|
pointsTeam2 = -1
|
||||||
|
|
||||||
|
|
||||||
m = Match(matchID=unicode(match['matchID']),
|
m = Match(matchID=match['matchID'],
|
||||||
matchDateTime=match['matchDateTime'],
|
matchDateTime=match['matchDateTime'],
|
||||||
pointsTeam1=pointsTeam1,
|
pointsTeam1=pointsTeam1,
|
||||||
pointsTeam2=pointsTeam2,
|
pointsTeam2=pointsTeam2,
|
||||||
finished=bool(match['matchIsFinished']),
|
finished=bool(match['matchIsFinished']),
|
||||||
)
|
)
|
||||||
m.save(update_fields=['matchDateTime', 'pointsTeam1', 'pointsTeam2', 'finished'])
|
m.save(update_fields=['matchDateTime', 'pointsTeam1', 'pointsTeam2', 'finished'])
|
||||||
pointsTeam1=-1
|
pointsTeam1 = -1
|
||||||
pointsTeam2=-1
|
pointsTeam2 = -1
|
||||||
|
|
||||||
# evaluate scores
|
# evaluate scores
|
||||||
scores = Score.objects.get(client=Mandant.objects.get(name='huse'))
|
""" get mandants current user is related """
|
||||||
finished_matches=Match.objects.filter(
|
mandants = RelUserMandant.objects.filter(user=request.user). \
|
||||||
finished=True,
|
values_list('mandant', flat=True)
|
||||||
|
|
||||||
|
# scores = Score.objects.get(client=Mandant.objects.get(name='huse'))
|
||||||
|
scores = Score.objects.get(client=mandants[0])
|
||||||
|
|
||||||
|
finished_matches = Match.objects.filter(
|
||||||
|
finished=True,
|
||||||
leagueShortcut=ls,
|
leagueShortcut=ls,
|
||||||
season=season,
|
season=season,
|
||||||
matchday = cur_md
|
matchday=cur_md
|
||||||
)
|
)
|
||||||
for match in finished_matches:
|
for match in finished_matches:
|
||||||
tipps = Tipp.objects.filter(matchID=match.matchID)
|
tipps = Tipp.objects.filter(matchID=match.matchID)
|
||||||
@@ -256,8 +262,8 @@ def update(request, ls, season, cur_md):
|
|||||||
goals_total = match.pointsTeam1 + match.pointsTeam2
|
goals_total = match.pointsTeam1 + match.pointsTeam2
|
||||||
|
|
||||||
# Tipp is acurate
|
# Tipp is acurate
|
||||||
if (tipp.pointsTeam1 == match.pointsTeam1
|
if (tipp.pointsTeam1 == match.pointsTeam1
|
||||||
and tipp.pointsTeam2 == match.pointsTeam2):
|
and tipp.pointsTeam2 == match.pointsTeam2):
|
||||||
if goals_total >= 5:
|
if goals_total >= 5:
|
||||||
score = scores.exact_high
|
score = scores.exact_high
|
||||||
else:
|
else:
|
||||||
@@ -266,29 +272,29 @@ def update(request, ls, season, cur_md):
|
|||||||
tipp.score = score
|
tipp.score = score
|
||||||
tipp.save()
|
tipp.save()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# who won?
|
# who won?
|
||||||
winnerReal = None
|
winnerReal = None
|
||||||
if match.pointsTeam1 > match.pointsTeam2:
|
if match.pointsTeam1 > match.pointsTeam2:
|
||||||
winnerReal = 1
|
winnerReal = 1
|
||||||
elif (match.pointsTeam2 > match.pointsTeam1):
|
elif match.pointsTeam2 > match.pointsTeam1:
|
||||||
winnerReal = 2
|
winnerReal = 2
|
||||||
elif (match.pointsTeam1 == match.pointsTeam2):
|
elif match.pointsTeam1 == match.pointsTeam2:
|
||||||
winnerReal = 0
|
winnerReal = 0
|
||||||
|
|
||||||
winnerTipp = None
|
winnerTipp = None
|
||||||
if tipp.pointsTeam1 > tipp.pointsTeam2:
|
if tipp.pointsTeam1 > tipp.pointsTeam2:
|
||||||
winnerTipp = 1
|
winnerTipp = 1
|
||||||
elif (tipp.pointsTeam2 > tipp.pointsTeam1):
|
elif tipp.pointsTeam2 > tipp.pointsTeam1:
|
||||||
winnerTipp = 2
|
winnerTipp = 2
|
||||||
elif (tipp.pointsTeam1 == tipp.pointsTeam2):
|
elif tipp.pointsTeam1 == tipp.pointsTeam2:
|
||||||
winnerTipp = 0
|
winnerTipp = 0
|
||||||
|
|
||||||
diffReal = match.pointsTeam1 - match.pointsTeam2
|
diffReal = match.pointsTeam1 - match.pointsTeam2
|
||||||
diffTipp = tipp.pointsTeam1 - tipp.pointsTeam2
|
diffTipp = tipp.pointsTeam1 - tipp.pointsTeam2
|
||||||
|
|
||||||
if ( winnerTipp == winnerReal ):
|
if winnerTipp == winnerReal:
|
||||||
if ( diffTipp == diffReal ):
|
if diffTipp == diffReal:
|
||||||
score = scores.diff
|
score = scores.diff
|
||||||
else:
|
else:
|
||||||
score = scores.tendency
|
score = scores.tendency
|
||||||
@@ -301,21 +307,23 @@ def update(request, ls, season, cur_md):
|
|||||||
tipp.save()
|
tipp.save()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return redirect("matchday",
|
return django.shortcuts.redirect("matchday",
|
||||||
ls=ls,
|
ls=ls,
|
||||||
season=season,
|
season=season,
|
||||||
matchday=cur_md
|
matchday=cur_md
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def matchday(request, ls, season, matchday, template_name='md.html'):
|
def matchday(request, ls, season, matchday, template_name='md.html'):
|
||||||
|
update(request, ls, season, matchday)
|
||||||
debug = ''
|
debug = ''
|
||||||
debug += "Debugging: "
|
debug += "Debugging: "
|
||||||
has_refresh = True
|
has_refresh = True
|
||||||
|
|
||||||
""" get matches of the matchday """
|
""" get matches of the matchday """
|
||||||
md_matches = Match.objects.filter(leagueShortcut=ls, season=season,
|
md_matches = Match.objects.filter(leagueShortcut=ls, season=season,
|
||||||
matchday=int(matchday)).order_by('matchDateTime')
|
matchday=int(matchday)).order_by('matchDateTime')
|
||||||
|
|
||||||
""" get the current user """
|
""" get the current user """
|
||||||
user = User.objects.get(username=request.user.username)
|
user = User.objects.get(username=request.user.username)
|
||||||
@@ -323,7 +331,7 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
|||||||
""" get mandants current user is related """
|
""" get mandants current user is related """
|
||||||
mandants = RelUserMandant.objects.filter(user=request.user). \
|
mandants = RelUserMandant.objects.filter(user=request.user). \
|
||||||
values_list('mandant', flat=True)
|
values_list('mandant', flat=True)
|
||||||
|
|
||||||
""" get mates """
|
""" get mates """
|
||||||
mandant_dict = {}
|
mandant_dict = {}
|
||||||
for m in mandants:
|
for m in mandants:
|
||||||
@@ -332,8 +340,8 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
|||||||
rs = RelUserMandant.objects.filter(mandant=m)
|
rs = RelUserMandant.objects.filter(mandant=m)
|
||||||
|
|
||||||
for r in rs:
|
for r in rs:
|
||||||
mandant_dict[mandant.description].append({
|
mandant_dict[mandant.description].append({
|
||||||
'mate': r.user,
|
'mate': r.user,
|
||||||
'tipps': [],
|
'tipps': [],
|
||||||
'sum_score': 0
|
'sum_score': 0
|
||||||
})
|
})
|
||||||
@@ -350,7 +358,7 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
tipp = Tipp.objects.get(tipperID=user.id,
|
tipp = Tipp.objects.get(tipperID=user.id,
|
||||||
matchID=match.matchID)
|
matchID=match.matchID)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
tipp = None
|
tipp = None
|
||||||
|
|
||||||
@@ -363,52 +371,52 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
|||||||
if tipp is not None:
|
if tipp is not None:
|
||||||
""" Tipp exists an needs an UPDATE"""
|
""" Tipp exists an needs an UPDATE"""
|
||||||
tipp = Tipp(id=tipp.pk,
|
tipp = Tipp(id=tipp.pk,
|
||||||
matchID=match,
|
matchID=match,
|
||||||
tipperID=user,
|
tipperID=user,
|
||||||
pointsTeam1=data['tippTeam1'],
|
pointsTeam1=data['tippTeam1'],
|
||||||
pointsTeam2=data['tippTeam2']
|
pointsTeam2=data['tippTeam2']
|
||||||
)
|
)
|
||||||
tipp.save()
|
tipp.save()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
""" do INSERT """
|
""" do INSERT """
|
||||||
tipp = Tipp( matchID=match,
|
tipp = Tipp(matchID=match,
|
||||||
tipperID=user,
|
tipperID=user,
|
||||||
pointsTeam1=data['tippTeam1'],
|
pointsTeam1=data['tippTeam1'],
|
||||||
pointsTeam2=data['tippTeam2'])
|
pointsTeam2=data['tippTeam2'])
|
||||||
tipp.save()
|
tipp.save()
|
||||||
|
|
||||||
match_started = timezone.now() >= match.matchDateTime
|
match_started = timezone.now() >= match.matchDateTime
|
||||||
|
|
||||||
if tipp is not None:
|
if tipp is not None:
|
||||||
f = TippForm(prefix=str(match.matchID),
|
f = TippForm(prefix=str(match.matchID),
|
||||||
initial={'tippTeam1': tipp.pointsTeam1,
|
initial={'tippTeam1': tipp.pointsTeam1,
|
||||||
'tippTeam2': tipp.pointsTeam2}
|
'tippTeam2': tipp.pointsTeam2}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
f = TippForm(prefix=str(match.matchID))
|
f = TippForm(prefix=str(match.matchID))
|
||||||
|
|
||||||
item = {}
|
item = {}
|
||||||
item['matchDateTime'] = (match.matchDateTime. \
|
item['matchDateTime'] = (match.matchDateTime.
|
||||||
astimezone(timezoneLocal).strftime('%a %d.%m, %H:%M'))
|
astimezone(timezoneLocal).strftime('%a %d.%m, %H:%M'))
|
||||||
|
|
||||||
item['iconTeam1']= str(match.idTeam1.icon)
|
item['iconTeam1'] = str(match.idTeam1.icon)
|
||||||
item['iconURLTeam1'] = str(match.idTeam1.iconURL)
|
item['iconURLTeam1'] = str(match.idTeam1.iconURL)
|
||||||
item['nameTeam1']= str(match.idTeam1)
|
item['nameTeam1'] = str(match.idTeam1.name)
|
||||||
item['abbrTeam1']= str(match.idTeam1.abbr)
|
item['abbrTeam1'] = str(match.idTeam1.abbr)
|
||||||
item['iconTeam2'] = str(match.idTeam2.icon)
|
item['iconTeam2'] = str(match.idTeam2.icon)
|
||||||
item['iconURLTeam2'] = str(match.idTeam2.iconURL)
|
item['iconURLTeam2'] = str(match.idTeam2.iconURL)
|
||||||
item['nameTeam2'] = str(match.idTeam2)
|
item['nameTeam2'] = str(match.idTeam2.name)
|
||||||
item['abbrTeam2']= str(match.idTeam2.abbr)
|
item['abbrTeam2'] = str(match.idTeam2.abbr)
|
||||||
item['started'] = match_started
|
item['started'] = match_started
|
||||||
item['finished'] = match.finished
|
item['finished'] = match.finished
|
||||||
item['md_name'] = match.matchday_name
|
item['md_name'] = match.matchday_name
|
||||||
|
|
||||||
if (match.pointsTeam1 == -1 or match.pointsTeam2 == -1):
|
if (match.pointsTeam1 == -1 or match.pointsTeam2 == -1):
|
||||||
item['matchResult'] = "-:-"
|
item['matchResult'] = "-:-"
|
||||||
else:
|
else:
|
||||||
item['matchResult'] = str(match.pointsTeam1) + ":" \
|
item['matchResult'] = str(match.pointsTeam1) + ":" \
|
||||||
+ str(match.pointsTeam2)
|
+ str(match.pointsTeam2)
|
||||||
|
|
||||||
item['tippFormTeam1'] = f['tippTeam1']
|
item['tippFormTeam1'] = f['tippTeam1']
|
||||||
item['tippFormTeam2'] = f['tippTeam2']
|
item['tippFormTeam2'] = f['tippTeam2']
|
||||||
@@ -422,27 +430,26 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
|||||||
for mate in mandant_dict[mandant]:
|
for mate in mandant_dict[mandant]:
|
||||||
try:
|
try:
|
||||||
matetipp = Tipp.objects.get(tipperID=mate['mate'],
|
matetipp = Tipp.objects.get(tipperID=mate['mate'],
|
||||||
matchID=match.matchID)
|
matchID=match.matchID)
|
||||||
if match_started is True:
|
if match_started is True:
|
||||||
if matetipp.score is None:
|
if matetipp.score is None:
|
||||||
score = u'\u231B'
|
score = u'\u231B'
|
||||||
else:
|
else:
|
||||||
score = matetipp.score
|
score = matetipp.score
|
||||||
|
|
||||||
mate['tipps'].append(str(matetipp.pointsTeam1)
|
mate['tipps'].append(str(matetipp.pointsTeam1)
|
||||||
+ ":" + str(matetipp.pointsTeam2)
|
+ ":" + str(matetipp.pointsTeam2)
|
||||||
+ "(" + str(score) + ")")
|
+ "(" + str(score) + ")")
|
||||||
if match.finished is True:
|
if match.finished is True:
|
||||||
mate['sum_score'] += matetipp.score
|
mate['sum_score'] += matetipp.score
|
||||||
else:
|
else:
|
||||||
mate['tipps'].append(u'\u2714')
|
mate['tipps'].append(u'\u2714')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
mate['tipps'].append(u'\u2717')
|
mate['tipps'].append(u'\u2717')
|
||||||
|
|
||||||
""" sort items in mandant_dict by score """
|
|
||||||
mandant_dict[mandant] = sorted(mandant_dict[mandant],
|
|
||||||
key=lambda k: k['sum_score'], reverse=True)
|
|
||||||
|
|
||||||
|
""" sort items in mandant_dict by score """
|
||||||
|
mandant_dict[mandant] = sorted(mandant_dict[mandant],
|
||||||
|
key=lambda k: k['sum_score'], reverse=True)
|
||||||
|
|
||||||
matches.append(item)
|
matches.append(item)
|
||||||
|
|
||||||
@@ -450,58 +457,58 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
|||||||
pm = RelPostMandant.objects.filter(mandant__in=mandants). \
|
pm = RelPostMandant.objects.filter(mandant__in=mandants). \
|
||||||
values_list('post', flat=True)
|
values_list('post', flat=True)
|
||||||
posts = []
|
posts = []
|
||||||
for post in Post.objects.filter(id__in=pm, published=True)[:1]:
|
for post in Post.objects.filter(id__in=pm, published=True)[:5]:
|
||||||
try:
|
try:
|
||||||
avatar = UserProfile.objects.get(user_id=post.author_id). \
|
avatar = UserProfile.objects.get(user_id=post.author_id). \
|
||||||
avatar.name
|
avatar.name
|
||||||
except:
|
except:
|
||||||
avatar = None
|
avatar = None
|
||||||
posts.append( (post, avatar) )
|
posts.append((post, avatar))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cur_group = matches[0]['md_name']
|
cur_group = matches[0]['md_name']
|
||||||
except:
|
except:
|
||||||
cur_group = "N/A"
|
cur_group = "N/A"
|
||||||
|
|
||||||
debug += str(mandant_dict)
|
debug += str(mandant_dict)
|
||||||
|
|
||||||
return render(request, 'md.html', {
|
return django.shortcuts.render(request, 'md.html', {
|
||||||
'debug': debug,
|
'debug': debug,
|
||||||
#'mds_season': mds_in_season,
|
# 'mds_season': mds_in_season,
|
||||||
'cur_md': matchday,
|
'cur_md': matchday,
|
||||||
'md_name': cur_group,
|
'md_name': cur_group,
|
||||||
'matches': matches,
|
'matches': matches,
|
||||||
'ls': ls,
|
'ls': ls,
|
||||||
'season': season,
|
'season': season,
|
||||||
'username': user,
|
'username': user,
|
||||||
'mandant_dict': mandant_dict,
|
'mandant_dict': mandant_dict,
|
||||||
#'tipp_mates': sorted(tipp_mates, key=lambda k: k['sum_score'],
|
# 'tipp_mates': sorted(tipp_mates, key=lambda k: k['sum_score'],
|
||||||
#reverse=True),
|
# reverse=True),
|
||||||
'posts': posts,
|
'posts': posts,
|
||||||
'has_refresh': has_refresh
|
'has_refresh': has_refresh
|
||||||
})
|
})
|
||||||
|
|
||||||
@login_required
|
|
||||||
def charts(request, ls, season, pos='default',
|
|
||||||
template_name='charts.html'):
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def charts(request, ls, season, pos='default',
|
||||||
|
template_name='charts.html'):
|
||||||
debug = ''
|
debug = ''
|
||||||
|
|
||||||
if pos == 'default':
|
if pos == 'default':
|
||||||
if get_current_md(ls) < 18:
|
if get_current_md(ls) < 18:
|
||||||
pos = 'hin'
|
pos = 'hin'
|
||||||
matches = Match.objects.filter(leagueShortcut=ls,
|
matches = Match.objects.filter(leagueShortcut=ls,
|
||||||
season=season, matchday__lte=17)
|
season=season, matchday__lte=17)
|
||||||
else:
|
else:
|
||||||
pos = 'rueck'
|
pos = 'rueck'
|
||||||
matches = Match.objects.filter(leagueShortcut=ls,
|
matches = Match.objects.filter(leagueShortcut=ls,
|
||||||
season=season, matchday__gte=18)
|
season=season, matchday__gte=18)
|
||||||
elif pos == 'hin':
|
elif pos == 'hin':
|
||||||
matches = Match.objects.filter(leagueShortcut=ls,
|
matches = Match.objects.filter(leagueShortcut=ls,
|
||||||
season=season, matchday__lte=17)
|
season=season, matchday__lte=17)
|
||||||
elif pos == 'rueck':
|
elif pos == 'rueck':
|
||||||
matches = Match.objects.filter(leagueShortcut=ls,
|
matches = Match.objects.filter(leagueShortcut=ls,
|
||||||
season=season, matchday__gte=18)
|
season=season, matchday__gte=18)
|
||||||
else:
|
else:
|
||||||
matches = Match.objects.filter(leagueShortcut=ls, season=season)
|
matches = Match.objects.filter(leagueShortcut=ls, season=season)
|
||||||
|
|
||||||
@@ -522,25 +529,26 @@ def charts(request, ls, season, pos='default',
|
|||||||
for userid in users:
|
for userid in users:
|
||||||
# get user object, then fetch matches for user
|
# get user object, then fetch matches for user
|
||||||
user = User.objects.get(id=userid)
|
user = User.objects.get(id=userid)
|
||||||
score = Tipp.objects.filter(matchID__in=matches, \
|
score = Tipp.objects.filter(matchID__in=matches,
|
||||||
tipperID=user).aggregate(Sum('score'))
|
tipperID=user).aggregate(Sum('score'))
|
||||||
|
|
||||||
if score['score__sum'] is None:
|
if score['score__sum'] is None:
|
||||||
user_dict[user.first_name] = 0
|
user_dict[user.first_name] = 0
|
||||||
else:
|
else:
|
||||||
user_dict[user.first_name] = score['score__sum']
|
user_dict[user.first_name] = score['score__sum']
|
||||||
|
|
||||||
mandant_dict[mandant.name] = sorted(user_dict.items(),
|
mandant_dict[mandant.name] = sorted(user_dict.items(),
|
||||||
key=lambda x: x[1], reverse=True)
|
key=lambda x: x[1], reverse=True)
|
||||||
|
|
||||||
return render(request, template_name, {
|
return django.shortcuts.render(request, template_name, {
|
||||||
#'debug': debug,
|
# 'debug': debug,
|
||||||
'mandant_dict': mandant_dict,
|
'mandant_dict': mandant_dict,
|
||||||
'season': season,
|
'season': season,
|
||||||
'ls': ls,
|
'ls': ls,
|
||||||
'pos': pos
|
'pos': pos
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def blogindex(request, page):
|
def blogindex(request, page):
|
||||||
# get the blog posts that are published
|
# get the blog posts that are published
|
||||||
@@ -555,9 +563,9 @@ def blogindex(request, page):
|
|||||||
try:
|
try:
|
||||||
avatar = UserProfile.objects.get(user_id=post.author_id). \
|
avatar = UserProfile.objects.get(user_id=post.author_id). \
|
||||||
avatar.name
|
avatar.name
|
||||||
except:
|
except:
|
||||||
avatar = None
|
avatar = None
|
||||||
post_list.append( (post, avatar) )
|
post_list.append((post, avatar))
|
||||||
|
|
||||||
p = Paginator(post_list, 5)
|
p = Paginator(post_list, 5)
|
||||||
|
|
||||||
@@ -568,13 +576,14 @@ def blogindex(request, page):
|
|||||||
except EmptyPage:
|
except EmptyPage:
|
||||||
posts = p.page(p.num_pages)
|
posts = p.page(p.num_pages)
|
||||||
|
|
||||||
return render(request, 'blogindex.html', {
|
return django.shortcuts.render(request, 'blogindex.html', {
|
||||||
'posts': posts,
|
'posts': posts,
|
||||||
'ls': get_current_ls(),
|
'ls': get_current_ls(),
|
||||||
'season': get_current_season(),
|
'season': get_current_season(),
|
||||||
'page': page
|
'page': page
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def newBlogpost(request):
|
def newBlogpost(request):
|
||||||
debug = ''
|
debug = ''
|
||||||
@@ -583,10 +592,10 @@ def newBlogpost(request):
|
|||||||
mandants = RelUserMandant.objects.filter(user=request.user). \
|
mandants = RelUserMandant.objects.filter(user=request.user). \
|
||||||
values_list('mandant', flat=True)
|
values_list('mandant', flat=True)
|
||||||
choices = []
|
choices = []
|
||||||
if mandants.count > 1:
|
if mandants.count() > 1:
|
||||||
has_mandant = True
|
has_mandant = True
|
||||||
for m in Mandant.objects.filter(id__in=mandants):
|
for m in Mandant.objects.filter(id__in=mandants):
|
||||||
choices.append( (m.name, m.description) )
|
choices.append((m.name, m.description))
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form_bp = BlogpostForm(request.POST)
|
form_bp = BlogpostForm(request.POST)
|
||||||
@@ -602,31 +611,32 @@ def newBlogpost(request):
|
|||||||
if has_mandant is True and form_mandant.is_valid():
|
if has_mandant is True and form_mandant.is_valid():
|
||||||
data = form_mandant.cleaned_data
|
data = form_mandant.cleaned_data
|
||||||
for m in data['mandants']:
|
for m in data['mandants']:
|
||||||
debug += str(m) + " "
|
debug += str(m) + " "
|
||||||
m = RelPostMandant(post=p,
|
m = RelPostMandant(post=p,
|
||||||
mandant=Mandant.objects.get(name=m))
|
mandant=Mandant.objects.get(name=m))
|
||||||
m.save()
|
m.save()
|
||||||
else:
|
else:
|
||||||
m = RelPostMandant(post=p,
|
m = RelPostMandant(post=p,
|
||||||
mandant=Mandant.objects.get(id=mandants[0]))
|
mandant=Mandant.objects.get(id=mandants[0]))
|
||||||
m.save()
|
m.save()
|
||||||
|
|
||||||
return redirect( '/blog/1')
|
return django.shortcuts.redirect('/blog/1')
|
||||||
|
|
||||||
blogpostForm = BlogpostForm()
|
blogpostForm = BlogpostForm()
|
||||||
form_mandant = MandantsForm()
|
form_mandant = MandantsForm()
|
||||||
form_mandant.fields["mandants"].choices = choices
|
form_mandant.fields["mandants"].choices = choices
|
||||||
cnt_mandants = len(choices)
|
cnt_mandants = len(choices)
|
||||||
|
|
||||||
return render(request, 'newblogpost.html', {
|
return django.shortcuts.render(request, 'newblogpost.html', {
|
||||||
'debug': debug,
|
'debug': debug,
|
||||||
'form_bp': blogpostForm,
|
'form_bp': blogpostForm,
|
||||||
'form_mandants': form_mandant,
|
'form_mandants': form_mandant,
|
||||||
'cnt_mandants' : cnt_mandants,
|
'cnt_mandants': cnt_mandants,
|
||||||
'ls': get_current_ls(),
|
'ls': get_current_ls(),
|
||||||
'season': get_current_season()
|
'season': get_current_season()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def logout(request):
|
def logout(request):
|
||||||
"""
|
"""
|
||||||
Log users out and re-direct them to the main page.
|
Log users out and re-direct them to the main page.
|
||||||
@@ -634,6 +644,7 @@ def logout(request):
|
|||||||
logout(request)
|
logout(request)
|
||||||
return HttpResponseRedirect('/')
|
return HttpResponseRedirect('/')
|
||||||
|
|
||||||
|
|
||||||
def get_current_md(ls):
|
def get_current_md(ls):
|
||||||
"""
|
"""
|
||||||
get current matchday()
|
get current matchday()
|
||||||
@@ -646,14 +657,15 @@ def get_current_md(ls):
|
|||||||
try:
|
try:
|
||||||
ol = OpenLiga()
|
ol = OpenLiga()
|
||||||
cur_md = ol.getCurrentGroup(ls)
|
cur_md = ol.getCurrentGroup(ls)
|
||||||
except:
|
except:
|
||||||
cur_md = {'groupName': u"1. Spieltag", 'groupOrderID': 1}
|
cur_md = {'groupName': u"1. Spieltag", 'groupOrderID': 1}
|
||||||
|
|
||||||
return(cur_md['groupOrderID'])
|
return (cur_md['groupOrderID'])
|
||||||
|
|
||||||
|
|
||||||
def get_current_ls():
|
def get_current_ls():
|
||||||
return("bl1")
|
return ("bl1")
|
||||||
|
|
||||||
|
|
||||||
def get_current_season():
|
def get_current_season():
|
||||||
return("2016")
|
return ("2022")
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
__version__ = '1.0.1'
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
"""
|
|
||||||
Django settings for tippy project.
|
|
||||||
|
|
||||||
For more information on this file, see
|
|
||||||
https://docs.djangoproject.com/en/1.7/topics/settings/
|
|
||||||
|
|
||||||
For the full list of settings and their values, see
|
|
||||||
https://docs.djangoproject.com/en/1.7/ref/settings/
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
||||||
import os
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
|
||||||
|
|
||||||
# Django settings for tippy project.
|
|
||||||
DEBUG = True
|
|
||||||
TEMPLATE_DEBUG = DEBUG
|
|
||||||
|
|
||||||
ADMINS = (
|
|
||||||
('Martin Bley', 'martin@mb-oss.de'),
|
|
||||||
)
|
|
||||||
|
|
||||||
MANAGERS = ADMINS
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
||||||
'NAME': 'tippy',
|
|
||||||
'USER': 'tippy',
|
|
||||||
'PASSWORD': 'tippy',
|
|
||||||
'HOST': 'localhost',
|
|
||||||
'PORT': '5432',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Hosts/domain names that are valid for this site; required if DEBUG is False
|
|
||||||
# See https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts
|
|
||||||
ALLOWED_HOSTS = ['*']
|
|
||||||
|
|
||||||
# Local time zone for this installation. Choices can be found here:
|
|
||||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
|
||||||
# although not all choices may be available on all operating systems.
|
|
||||||
# In a Windows environment this must be set to your system time zone.
|
|
||||||
TIME_ZONE = 'Europe/Berlin'
|
|
||||||
|
|
||||||
# Language code for this installation. All choices can be found here:
|
|
||||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
|
||||||
LANGUAGE_CODE = 'de-de'
|
|
||||||
|
|
||||||
SITE_ID = 1
|
|
||||||
|
|
||||||
# If you set this to False, Django will make some optimizations so as not
|
|
||||||
# to load the internationalization machinery.
|
|
||||||
USE_I18N = True
|
|
||||||
|
|
||||||
# If you set this to False, Django will not format dates, numbers and
|
|
||||||
# calendars according to the current locale.
|
|
||||||
USE_L10N = True
|
|
||||||
|
|
||||||
# If you set this to False, Django will not use timezone-aware datetimes.
|
|
||||||
USE_TZ = True
|
|
||||||
|
|
||||||
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
|
||||||
# Example: "/home/media/media.lawrence.com/media/"
|
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
|
||||||
|
|
||||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
|
||||||
# trailing slash.
|
|
||||||
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
|
||||||
MEDIA_URL = '/media/'
|
|
||||||
|
|
||||||
# Absolute path to the directory static files should be collected to.
|
|
||||||
# Don't put anything in this directory yourself; store your static files
|
|
||||||
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
|
||||||
# Example: "/home/media/media.lawrence.com/static/"
|
|
||||||
STATIC_ROOT = '/home/martin/dev/TipPy/src/static/'
|
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
|
||||||
|
|
||||||
# URL prefix for static files.
|
|
||||||
# Example: "http://media.lawrence.com/static/"
|
|
||||||
STATIC_URL = '/static/'
|
|
||||||
|
|
||||||
# Additional locations of static files
|
|
||||||
STATICFILES_DIRS = (
|
|
||||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
|
||||||
# Always use forward slashes, even on Windows.
|
|
||||||
# Don't forget to use absolute paths, not relative paths.
|
|
||||||
'/home/martin/dev/TipPy/src/tippy/static/',
|
|
||||||
)
|
|
||||||
|
|
||||||
# List of finder classes that know how to find static files in
|
|
||||||
# various locations.
|
|
||||||
STATICFILES_FINDERS = (
|
|
||||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
||||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
||||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
|
||||||
)
|
|
||||||
|
|
||||||
# Make this unique, and don't share it with anybody.
|
|
||||||
SECRET_KEY = '-7%ge^nl1b0t0694%ws&0$ft_lo)j4l1f-qv#ku^=$)s(sw6us'
|
|
||||||
|
|
||||||
# List of callables that know how to import templates from various sources.
|
|
||||||
TEMPLATE_LOADERS = (
|
|
||||||
'django.template.loaders.filesystem.Loader',
|
|
||||||
'django.template.loaders.app_directories.Loader',
|
|
||||||
# 'django.template.loaders.eggs.Loader',
|
|
||||||
)
|
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
|
||||||
'django.middleware.common.CommonMiddleware',
|
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
|
||||||
# Uncomment the next line for simple clickjacking protection:
|
|
||||||
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
||||||
)
|
|
||||||
|
|
||||||
ROOT_URLCONF = 'tippy.urls'
|
|
||||||
|
|
||||||
# Python dotted path to the WSGI application used by Django's runserver.
|
|
||||||
WSGI_APPLICATION = 'tippy.wsgi.application'
|
|
||||||
|
|
||||||
TEMPLATE_DIRS = (
|
|
||||||
[os.path.join(BASE_DIR, 'templates')]
|
|
||||||
)
|
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
|
||||||
'django.contrib.auth',
|
|
||||||
'django.contrib.contenttypes',
|
|
||||||
'django.contrib.sessions',
|
|
||||||
'django.contrib.sites',
|
|
||||||
'django.contrib.messages',
|
|
||||||
'django.contrib.staticfiles',
|
|
||||||
'django.contrib.humanize',
|
|
||||||
# Uncomment the next line to enable the admin:
|
|
||||||
'django.contrib.admin',
|
|
||||||
# Uncomment the next line to enable admin documentation:
|
|
||||||
'django.contrib.admindocs',
|
|
||||||
'tipp',
|
|
||||||
)
|
|
||||||
|
|
||||||
# URL of the login page.
|
|
||||||
LOGIN_URL = '/login'
|
|
||||||
|
|
||||||
# A sample logging configuration. The only tangible logging
|
|
||||||
# performed by this configuration is to send an email to
|
|
||||||
# the site admins on every HTTP 500 error when DEBUG=False.
|
|
||||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
|
||||||
# more details on how to customize your logging configuration.
|
|
||||||
LOGGING = {
|
|
||||||
'version': 1,
|
|
||||||
'disable_existing_loggers': False,
|
|
||||||
'filters': {
|
|
||||||
'require_debug_false': {
|
|
||||||
'()': 'django.utils.log.RequireDebugFalse'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'handlers': {
|
|
||||||
'mail_admins': {
|
|
||||||
'level': 'ERROR',
|
|
||||||
'filters': ['require_debug_false'],
|
|
||||||
'class': 'django.utils.log.AdminEmailHandler'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'loggers': {
|
|
||||||
'django.request': {
|
|
||||||
'handlers': ['mail_admins'],
|
|
||||||
'level': 'ERROR',
|
|
||||||
'propagate': True,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EMAIL_USE_TLS = True
|
|
||||||
EMAIL_HOST = 'hermes.mb-oss.de'
|
|
||||||
EMAIL_PORT = 25
|
|
||||||
EMAIL_HOST_USER = 'tippy@mb-oss.de'
|
|
||||||
#EMAIL_HOST_PASSWORD = 'p@ssword'
|
|
||||||
|
|
||||||
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
|
|
||||||
SERVER_EMAIL = EMAIL_HOST_USER
|
|
||||||
|
|
||||||
SESSION_COOKIE_AGE = 7200
|
|
||||||
|
|
||||||
AUTH_PROFILE_MODULE = 'tippy.UserProfile'
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
from django.conf.urls import patterns, include, url
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
# Uncomment the next two lines to enable the admin:
|
|
||||||
from django.contrib import admin
|
|
||||||
admin.autodiscover()
|
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
|
||||||
# Examples:
|
|
||||||
url(r'^$', 'tipp.views.home', name='home'),
|
|
||||||
url(r'^login$', 'django.contrib.auth.views.login', {
|
|
||||||
'template_name': 'login.html'}),
|
|
||||||
url(r'^logout$', 'django.contrib.auth.views.logout', {
|
|
||||||
'next_page': '/'}),
|
|
||||||
url(r'^getSeason/(?P<ls>.*)/(?P<season>\d{4})$',
|
|
||||||
'tipp.views.getSeason'),
|
|
||||||
url(r'^update/(?P<ls>.*)/(?P<season>\d{4})/(?P<cur_md>\d{2})$',
|
|
||||||
'tipp.views.update', name='update'),
|
|
||||||
url(r'^matchday/(?P<ls>.{3,})/(?P<season>\d{4})/(?P<matchday>\d{2})$',
|
|
||||||
'tipp.views.matchday', name='matchday'),
|
|
||||||
url(r'^charts/(?P<ls>\w{3,})/(?P<season>\d{4})$', 'tipp.views.charts',
|
|
||||||
name='charts'),
|
|
||||||
url(r'^charts/(?P<ls>\w{3,})/(?P<season>\d{4})/(?P<pos>\w{1,})$',
|
|
||||||
'tipp.views.charts', name='charts'),
|
|
||||||
url(r'^accounts/profile/(\d+)', 'tipp.views.profile'),
|
|
||||||
url(r'^accounts/', include('django.contrib.auth.urls')),
|
|
||||||
url(r'^blog/newpost$', 'tipp.views.newBlogpost'),
|
|
||||||
url(r'^blog/(?P<page>\d)$', 'tipp.views.blogindex'),
|
|
||||||
url(r'^about$', 'tipp.views.about'),
|
|
||||||
|
|
||||||
# Uncomment the admin/doc line below to enable admin documentation:
|
|
||||||
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
|
||||||
|
|
||||||
# Uncomment the next line to enable the admin:
|
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
|
||||||
)
|
|
||||||
|
|
||||||
if settings.DEBUG:
|
|
||||||
urlpatterns += patterns('',
|
|
||||||
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
|
|
||||||
'document_root': settings.MEDIA_ROOT,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
"""
|
|
||||||
WSGI config for tippy project.
|
|
||||||
|
|
||||||
This module contains the WSGI application used by Django's development server
|
|
||||||
and any production WSGI deployments. It should expose a module-level variable
|
|
||||||
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
|
|
||||||
this application via the ``WSGI_APPLICATION`` setting.
|
|
||||||
|
|
||||||
Usually you will have the standard Django WSGI application here, but it also
|
|
||||||
might make sense to replace the whole Django WSGI application with a custom one
|
|
||||||
that later delegates to the Django one. For example, you could introduce WSGI
|
|
||||||
middleware here, or combine a Django application with an application of another
|
|
||||||
framework.
|
|
||||||
|
|
||||||
"""
|
|
||||||
import os
|
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tippy.settings")
|
|
||||||
|
|
||||||
# This application object is used by any WSGI server configured to use this
|
|
||||||
# file. This includes Django's development server, if the WSGI_APPLICATION
|
|
||||||
# setting points here.
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
|
||||||
application = get_wsgi_application()
|
|
||||||
|
|
||||||
# Apply WSGI middleware here.
|
|
||||||
# from helloworld.wsgi import HelloWorldApplication
|
|
||||||
# application = HelloWorldApplication(application)
|
|
||||||
Reference in New Issue
Block a user