Jonas Havelka
4 months ago
178 changed files with 3 additions and 741 deletions
@ -1,16 +0,0 @@ |
|||||
git hooks |
|
||||
========= |
|
||||
|
|
||||
Kontrola stylu pythoních zdrojáků pomocí flake8. Kontrolujeme jen změny, |
|
||||
abychom nenutili lidi dělat nesouvisející úpravy, které by rozbíjely historii |
|
||||
(git blame). |
|
||||
|
|
||||
pre-commit |
|
||||
---------- |
|
||||
* kontrola změn před commitnutím |
|
||||
* instalace: lokálně zkopírovat do .git/hooks (musí být spustitelný) |
|
||||
|
|
||||
update |
|
||||
------ |
|
||||
* kontrola změn přicházejících s pushem |
|
||||
* instalace: na atreyi zkopírovat do /akce/MaM/MaMweb/mamweb.git/hooks |
|
@ -1,30 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
# |
|
||||
# Git hook script to verify what is about to be committed. |
|
||||
# Checks that the changes don't introduce new flake8 errors. |
|
||||
|
|
||||
TMPDIFF=`tempfile` |
|
||||
FLAKE8="`git rev-parse --show-toplevel`/bin/flake8" |
|
||||
|
|
||||
status=0 |
|
||||
|
|
||||
# select only changed python files which are not migrations |
|
||||
changed=`git diff --cached --name-only | grep 'py$' | grep -v 'migrations/[0-9]'` |
|
||||
if [ -z $changed ] ; then |
|
||||
# Nothing to check. Note the exit is necessary -- we would not pass any |
|
||||
# paths to git diff below and it would output the diff unfiltered. |
|
||||
exit 0 |
|
||||
fi |
|
||||
|
|
||||
git diff --unified=1 --cached HEAD -- $changed > $TMPDIFF |
|
||||
|
|
||||
# only do the check when there are some changes to be commited |
|
||||
# otherwise flake8 would hang waiting for input |
|
||||
if [ -s $TMPDIFF ] ; then |
|
||||
cat $TMPDIFF | $FLAKE8 --diff |
|
||||
status=$? |
|
||||
fi |
|
||||
|
|
||||
rm -f $TMPDIFF |
|
||||
|
|
||||
exit $status |
|
@ -1,61 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
# git update hook to check that pushed changes don't introduce new flake8 |
|
||||
# errors |
|
||||
|
|
||||
# --- Command line |
|
||||
refname="$1" |
|
||||
oldrev="$2" |
|
||||
newrev="$3" |
|
||||
|
|
||||
# --- Safety check |
|
||||
if [ -z "$GIT_DIR" ]; then |
|
||||
echo "Don't run this script from the command line." >&2 |
|
||||
echo " (if you want, you could supply GIT_DIR then run" >&2 |
|
||||
echo " $0 <ref> <oldrev> <newrev>)" >&2 |
|
||||
exit 1 |
|
||||
fi |
|
||||
|
|
||||
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then |
|
||||
echo "usage: $0 <ref> <oldrev> <newrev>" >&2 |
|
||||
exit 1 |
|
||||
fi |
|
||||
|
|
||||
|
|
||||
TMPDIR=`mktemp -d` |
|
||||
TMPDIFF=`tempfile` |
|
||||
|
|
||||
[ $refname != "refs/heads/master" -a $refname != "refs/heads/stable" ] && exit 0 |
|
||||
|
|
||||
# select only changed python files which are not migrations |
|
||||
changed=`git diff --name-only $oldrev $newrev | grep 'py$' | grep -v 'migrations/[0-9]'` |
|
||||
if [ -z $changed ] ; then |
|
||||
# Nothing to check. Note the exit is necessary -- we would not pass any |
|
||||
# paths to git diff below and it would output the diff unfiltered. |
|
||||
exit 0 |
|
||||
fi |
|
||||
|
|
||||
git diff --unified=1 $oldrev $newrev -- $changed >${TMPDIFF} |
|
||||
|
|
||||
# there is no working tree in bare git repository, so we recreate it for flake8 |
|
||||
git archive $newrev | tar -x -C ${TMPDIR} |
|
||||
|
|
||||
cd ${TMPDIR} |
|
||||
# report only errors on lines in diff |
|
||||
# (if threre was flake8 installed on atrey, we could just call flake8) |
|
||||
/akce/MaM/WWW/mamweb-test/bin/flake8 --diff <${TMPDIFF} |
|
||||
status=$? |
|
||||
if [ $status != 0 ] ; then |
|
||||
echo |
|
||||
echo -n "Změny, které se snažíte pushnout, obsahují kód v pythonu " |
|
||||
echo -n "nevyhovující flake8 (viz výše). Opravte je a zkuste to znovu. " |
|
||||
echo -n "Nezapomeňte, že můžete editovat historii (git commit --amend, " |
|
||||
echo -n "git rebase -i). Pokud byste chybu příště raději odhalili už při " |
|
||||
echo "commitu, zkopírujte si pre-commit hook z _git_hooks do .git/hooks." |
|
||||
echo |
|
||||
fi |
|
||||
|
|
||||
rm -rf ${TMPDIR} |
|
||||
rm -f ${TMPDIFF} |
|
||||
|
|
||||
exit $status |
|
@ -1,7 +1,2 @@ |
|||||
""" |
|
||||
Soubory sloužící k deklaraci jednotlivých „views“ (nejčastěji funkce beroucí request |
|
||||
a vracející :func:`django.shortcuts.render` respektive nějakou response, nebo |
|
||||
třídy většinou rozšiřující nějakou třídu z :mod:`django.views.generic`) |
|
||||
""" |
|
||||
from .autocomplete import * |
from .autocomplete import * |
||||
from .exports import * |
from .exports import * |
||||
|
@ -1,3 +1,4 @@ |
|||||
|
FIXME přepsat do rst, přidat i další věci a případně přesunout na wiki |
||||
Přidání obrázků do odměn: |
Přidání obrázků do odměn: |
||||
admin -> flatpage odměn -> ikona přidat obrázek |
admin -> flatpage odměn -> ikona přidat obrázek |
||||
záložka odeslat, vybrat obrázek, odeslat |
záložka odeslat, vybrat obrázek, odeslat |
@ -1,25 +0,0 @@ |
|||||
======== |
|
||||
| TODO | |
|
||||
|======| |
|
||||
|
|
||||
Aktualni |
|
||||
* co s titulni fotkou |
|
||||
* do CSS |
|
||||
* nahledy |
|
||||
* nastylovat tabulku s nahledy |
|
||||
* komentare uz na nahledy? |
|
||||
* detail |
|
||||
* nahledy pred a po |
|
||||
* opravit prechodove sipky |
|
||||
* vyrobit prechodove sipky ve M&M-stylu |
|
||||
|
|
||||
Dlouhodobe |
|
||||
* sipky na prechazeni mezi fotkami |
|
||||
* hromadne PRIDANI fotek do jiz existujici galerie |
|
||||
|
|
||||
Fylozoficke |
|
||||
* zvolit velikosti velke a male fotky |
|
||||
* je potreba i jine razeni nez automaticky podle casu nebo staci podgalerie? |
|
||||
* napr. dve hry na dvou ruznych mistech ve stejny cas |
|
||||
* fotky od ucastniku ze hry (skupinky se pohybuji ve stejny cas, ale maji sled fotek) -- nestaci to pripadne vrazit do podgalerii? |
|
||||
|
|
@ -1,47 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
|
|
||||
from autocomplete_light import shortcuts as autocomplete_light |
|
||||
|
|
||||
from .models import Obrazek, Galerie |
|
||||
from .views import cesta_od_korene |
|
||||
|
|
||||
|
|
||||
class ObrazekAutocomplete(autocomplete_light.AutocompleteModelBase): |
|
||||
|
|
||||
model = Obrazek |
|
||||
search_fields = ['nazev', 'popis'] |
|
||||
split_words = True |
|
||||
limit_choices = 15 |
|
||||
attrs = { |
|
||||
# This will set the input placeholder attribute: |
|
||||
'placeholder': u'Obrázek', |
|
||||
# This will set the yourlabs.Autocomplete.minimumCharacters |
|
||||
# options, the naming conversion is handled by jQuery |
|
||||
'data-autocomplete-minimum-characters': 1, |
|
||||
} |
|
||||
|
|
||||
choice_html_format = ''' |
|
||||
<span class="block" data-value="{}"> |
|
||||
<span class="block"> |
|
||||
{} |
|
||||
<span class="block">{}</span> |
|
||||
</span> |
|
||||
</span> |
|
||||
''' |
|
||||
|
|
||||
def choice_label(self, obrazek): |
|
||||
cesta = "/".join(g.nazev for g in cesta_od_korene(obrazek.galerie)) |
|
||||
popis = "{}<br>".format(obrazek.popis) if obrazek.popis else "" |
|
||||
return '{}<br>{}{}'.format(obrazek.nazev, popis, cesta) |
|
||||
|
|
||||
def choice_html(self, obrazek): |
|
||||
"""Vrátí kus html i s obrázkem, které se pak ukazuje v nabídce""" |
|
||||
return self.choice_html_format.format(self.choice_value(obrazek), |
|
||||
obrazek.obrazek_maly_tag(), self.choice_label(obrazek)) |
|
||||
|
|
||||
widget_attrs={ |
|
||||
'data-widget-maximum-values': 15, |
|
||||
'class': 'modern-style', |
|
||||
} |
|
||||
|
|
||||
autocomplete_light.register(ObrazekAutocomplete) |
|
@ -1,11 +0,0 @@ |
|||||
- korektura potrebuje reakci |
|
||||
+ komentáře fixně na username |
|
||||
- používat skutečné jméno? |
|
||||
- vyžádat pozornost autora obsahu |
|
||||
- zvednout upload limit na 5MB |
|
||||
- sbalit a rozbalit korekturu |
|
||||
- nahrávání jiných věcí než PDF - kontrolovat? |
|
||||
- stylování |
|
||||
- seznam PDF - co zobrazovat? |
|
||||
|
|
||||
|
|
@ -1,3 +0,0 @@ |
|||||
from django.test import TestCase |
|
||||
|
|
||||
# Create your tests here. |
|
@ -1,88 +0,0 @@ |
|||||
from datetime import datetime, date |
|
||||
|
|
||||
from django.conf import settings |
|
||||
from django.http import HttpResponse, HttpResponseRedirect |
|
||||
|
|
||||
|
|
||||
|
|
||||
class LoggedInHintCookieMiddleware(object): |
|
||||
"""Middleware to securely help with 'logged-in' detection for dual HTTP/HTTPS sites. |
|
||||
|
|
||||
On insecure requests: Checks for a (non-secure) cookie settings.LOGGED_IN_HINT_COOKIE_NAME |
|
||||
and if present, redirects to HTTPS (same adress). |
|
||||
Note this usually breaks non-GET (POST) requests. |
|
||||
|
|
||||
On secure requests: Updates cookie settings.LOGGED_IN_HINT_COOKIE_NAME to reflect |
|
||||
whether an user is logged in in the current session (cookie set to 'True' or cleared). |
|
||||
The cookie is set to expire at the same time as the sessionid cookie. |
|
||||
|
|
||||
By default, LOGGED_IN_HINT_COOKIE_NAME = 'logged_in_hint'. |
|
||||
""" |
|
||||
|
|
||||
def __init__(self): |
|
||||
if hasattr(settings, 'LOGGED_IN_HINT_COOKIE_NAME'): |
|
||||
self.cookie_name = settings.LOGGED_IN_HINT_COOKIE_NAME |
|
||||
else: self.cookie_name = 'logged_in_hint' |
|
||||
self.cookie_value = 'True' |
|
||||
|
|
||||
def cookie_correct(self, request): |
|
||||
return self.cookie_name in request.COOKIES and request.COOKIES[self.cookie_name] == self.cookie_value |
|
||||
|
|
||||
def process_request(self, request): |
|
||||
if not request.is_secure(): |
|
||||
if self.cookie_correct(request): |
|
||||
# redirect insecure (assuming http) requests with hint cookie to https |
|
||||
url = request.build_absolute_uri() |
|
||||
assert url[:5] == 'http:' |
|
||||
return HttpResponseRedirect('https:' + url[5:]) |
|
||||
return None |
|
||||
|
|
||||
def process_response(self, request, response): |
|
||||
if request.is_secure(): |
|
||||
# assuming full session info (as the conn. is secure) |
|
||||
try: |
|
||||
user = request.user |
|
||||
except AttributeError: # no user - ajax or other special request |
|
||||
return response |
|
||||
if user.is_authenticated(): |
|
||||
if not self.cookie_correct(request): |
|
||||
expiry = None if request.session.get_expire_at_browser_close() else request.session.get_expiry_date() |
|
||||
response.set_cookie(self.cookie_name, value=self.cookie_value, expires=expiry, secure=False) |
|
||||
else: |
|
||||
if self.cookie_name in request.COOKIES: |
|
||||
response.delete_cookie(self.cookie_name) |
|
||||
return response |
|
||||
|
|
||||
|
|
||||
class vzhled: |
|
||||
|
|
||||
def process_request(self, request): |
|
||||
return None |
|
||||
|
|
||||
def process_view(self, request, view_func, view_args, view_kwargs): |
|
||||
#print "====== process_request ======" |
|
||||
#print view_func |
|
||||
#print view_args |
|
||||
#print view_kwargs |
|
||||
#print "=============================" |
|
||||
return None |
|
||||
|
|
||||
def process_template_response(self, request, response): |
|
||||
hodin = datetime.now().hour |
|
||||
if (hodin <= 6) or (hodin >= 14): # TODO 20 |
|
||||
response.context_data['noc'] = True |
|
||||
else: |
|
||||
response.context_data['noc'] = False |
|
||||
return response |
|
||||
|
|
||||
def process_response(self, request, response): |
|
||||
#hodin = datetime.now().hour |
|
||||
#if (hodin <= 6) or (hodin >= 14): # TODO 20 |
|
||||
#response.context_data['noc'] = True |
|
||||
#else: |
|
||||
#response.context_data['noc'] = False |
|
||||
return response |
|
||||
|
|
||||
|
|
||||
##def process_exception(request, exception): |
|
||||
#pass |
|
@ -1,6 +1,5 @@ |
|||||
from django.apps import AppConfig |
from django.apps import AppConfig |
||||
|
|
||||
class NovinkyConfig(AppConfig): |
class NovinkyConfig(AppConfig): |
||||
default_auto_field = 'django.db.models.BigAutoField' |
|
||||
name = 'novinky' |
name = 'novinky' |
||||
verbose_name = 'Novinky' |
verbose_name = 'Novinky' |
||||
|
@ -1,3 +0,0 @@ |
|||||
from django.test import TestCase |
|
||||
|
|
||||
# Create your tests here. |
|
@ -1,3 +0,0 @@ |
|||||
from django.shortcuts import render |
|
||||
|
|
||||
# Create your views here. |
|
@ -1,3 +0,0 @@ |
|||||
from django.test import TestCase |
|
||||
|
|
||||
# Create your tests here. |
|
@ -1,7 +1,6 @@ |
|||||
from django.apps import AppConfig |
from django.apps import AppConfig |
||||
|
|
||||
class SeminarConfig(AppConfig): |
class SeminarConfig(AppConfig): |
||||
default_auto_field = 'django.db.models.BigAutoField' |
|
||||
name = 'seminar' |
name = 'seminar' |
||||
verbose_name = 'Seminář' |
verbose_name = 'Seminář' |
||||
|
|
||||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue