From b209344e8756e4d2f83c3a252538edd8cea94ff4 Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Sat, 14 Mar 2015 15:41:29 +0100 Subject: [PATCH] Remove allauth, add 'make run', clean config, add Nastaveni --- Makefile | 3 +++ mamweb/settings_common.py | 6 ++++++ mamweb/urls.py | 1 - requirements.txt | 31 ++++++++++++++++++++----------- seminar/admin.py | 6 +++++- seminar/models.py | 26 +++++++++++++++++++++++--- 6 files changed, 57 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 6b433456..0c62bbbf 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,9 @@ virtualenv: clean_virtualenv: rm -rf virtualenv/ +run: + ./manage.py runserver_plus + TEST_USER=${USER} TEST_SERVER=atrey.karlin.mff.cuni.cz diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index b5f8b3b9..f6ebadae 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -76,6 +76,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( ) INSTALLED_APPS = ( + # Basic 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -84,11 +85,16 @@ INSTALLED_APPS = ( 'django.contrib.sites', 'django.contrib.staticfiles', + # Utilities 'sekizai', 'reversion', + 'django_countries', + 'solo', + # MaMweb 'mamweb', 'seminar', + ) # MaM specific diff --git a/mamweb/urls.py b/mamweb/urls.py index 18a20203..7e22c28f 100644 --- a/mamweb/urls.py +++ b/mamweb/urls.py @@ -7,7 +7,6 @@ from django.conf import settings urlpatterns = i18n_patterns('', url(r'^admin/', include(admin.site.urls)), # NOQA - url(r'^accounts/', include('allauth.urls')), url(r'^', include('seminar.urls')), ) diff --git a/requirements.txt b/requirements.txt index 7dd4ba02..b1422055 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,24 +1,33 @@ +# basic libs + +html5lib==0.999 +ipython==3.0.0 +Pillow==2.7.0 +pytz==2014.10 +six==1.9.0 + +# Django + Django==1.7.5 django-bootstrap-sass==0.0.6a0 django-mptt==0.6.1 django-reversion==1.8.5 django-sekizai==0.8.1 +django-countries==3.2 +django-solo==1.1.0 + +# debug tools/extensions django-debug-toolbar==1.3.0 django-extensions==1.5.1 sqlparse==0.1.14 Werkzeug==0.10.1 -django-allauth==0.19.1 -oauthlib==0.7.2 -python-openid==2.2.5 -requests==2.5.3 -requests-oauthlib==0.4.2 - -html5lib==0.999 -ipython==3.0.0 -Pillow==2.7.0 -pytz==2014.10 -six==1.9.0 +# G+, FB authorisation +# django-allauth==0.19.1 +# oauthlib==0.7.2 +# python-openid==2.2.5 +# requests==2.5.3 +# requests-oauthlib==0.4.2 diff --git a/seminar/admin.py b/seminar/admin.py index 9a8c60f8..7b7afdb0 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- from django.contrib import admin -from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni +from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni +from solo.admin import SingletonModelAdmin +### Nastaveni + +admin.site.register(Nastaveni, SingletonModelAdmin) ### Skola diff --git a/seminar/models.py b/seminar/models.py index 3e84b1e5..b1a4da36 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -10,6 +10,9 @@ from django.conf import settings from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import force_unicode +from django_countries.fields import CountryField +from solo.models import SingletonModel + # # Mělo by být částečně vytaženo z Aesopa # viz https://ovvp.mff.cuni.cz/wiki/aesop/export-skol. @@ -52,7 +55,8 @@ class Skola(models.Model): psc = models.CharField(u'PSČ', max_length=32) # ISO 3166-1 dvojznakovy kod zeme velkym pismem (CZ, SK) - stat = models.CharField(u'kód státu', max_length=2, default='CZ', + # Ekvivalentní s CharField(max_length=2, default='CZ', ...) + stat = CountryField(u'kód státu', default='CZ', help_text=u'ISO 3166-1 kód zeme velkými písmeny (CZ, SK, ...)') def __str__(self): @@ -121,8 +125,9 @@ class Resitel(models.Model): psc = models.CharField(u'PSČ', max_length=32, blank=True, default='') # ISO 3166-1 dvojznakovy kod zeme velkym pismem (CZ, SK) - stat = models.CharField(u'kód státu', max_length=2, - help_text=u'ISO 3166-1 kód zeme velkými písmeny (CZ, SK, ...)', default='CZ') + # Ekvivalentní s CharField(max_length=2, default='CZ', ...) + stat = CountryField(u'kód státu', default='CZ', + help_text=u'ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)') def plne_jmeno(self): return force_unicode(u'%s %s' % (self.jmeno, self.prijmeni)) @@ -298,3 +303,18 @@ class PrilohaReseni(models.Model): return force_unicode(self.soubor) +@python_2_unicode_compatible +class Nastaveni(SingletonModel): + + class Meta: + db_table = 'seminar_nastaveni' + verbose_name = u'Nastavení semináře' + + aktualni_rocnik = models.ForeignKey(Rocnik, verbose_name=u'aktuální ročník', null=False) + + aktualni_cislo = models.ForeignKey(Cislo, verbose_name=u'poslední vydané číslo', null=False) + + def __str__(self): + return u'Nastavení semináře' + +