Move aesop do aplikace aesop
This commit is contained in:
parent
4215e32954
commit
8d59f32036
10 changed files with 53 additions and 35 deletions
3
aesop/__init__.py
Normal file
3
aesop/__init__.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
"""
|
||||||
|
Obsahuje vše, co se týká aesopu (exportu, který po nás vyžaduje OPMK).
|
||||||
|
"""
|
5
aesop/apps.py
Normal file
5
aesop/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class AesopConfig(AppConfig):
|
||||||
|
name = 'aesop'
|
0
aesop/migrations/__init__.py
Normal file
0
aesop/migrations/__init__.py
Normal file
20
aesop/urls.py
Normal file
20
aesop/urls.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
from django.urls import path
|
||||||
|
from aesop import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path(
|
||||||
|
'aesop-export/mam-rocnik-<int:prvni_rok>.csv',
|
||||||
|
views.ExportRocnikView.as_view(),
|
||||||
|
name='seminar_export_rocnik'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'aesop-export/mam-sous-<str:datum_zacatku>.csv',
|
||||||
|
views.ExportSousView.as_view(),
|
||||||
|
name='seminar_export_sous'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'aesop-export/index.csv',
|
||||||
|
views.ExportIndexView.as_view(),
|
||||||
|
name='seminar_export_index'
|
||||||
|
),
|
||||||
|
]
|
16
aesop/utils.py
Normal file
16
aesop/utils.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from django.utils.encoding import force_text
|
||||||
|
|
||||||
|
from aesop.ovvpfile import OvvpFile
|
||||||
|
|
||||||
|
|
||||||
|
def default_ovvpfile(event, rocnik):
|
||||||
|
of = OvvpFile()
|
||||||
|
of.headers['version'] = '1'
|
||||||
|
of.headers['event'] = event
|
||||||
|
of.headers['year'] = force_text(rocnik.prvni_rok)
|
||||||
|
of.headers['date'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
of.headers['id-scope'] = 'mam'
|
||||||
|
of.headers['id-generation'] = '1'
|
||||||
|
return of
|
|
@ -1,14 +1,12 @@
|
||||||
import datetime, django
|
import django
|
||||||
from django.shortcuts import get_object_or_404, render
|
from django.shortcuts import get_object_or_404
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.views import generic
|
from django.views import generic
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
|
|
||||||
from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni
|
from .utils import default_ovvpfile
|
||||||
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
|
from seminar.models import Rocnik, Soustredeni
|
||||||
from .ovvpfile import OvvpFile
|
|
||||||
from seminar import views
|
|
||||||
from seminar.views import vysledkovka
|
from seminar.views import vysledkovka
|
||||||
from seminar.utils import aktivniResitele
|
from seminar.utils import aktivniResitele
|
||||||
|
|
||||||
|
@ -25,17 +23,6 @@ class ExportIndexView(generic.View):
|
||||||
return HttpResponse('\n'.join(ls) + '\n', content_type='text/plain; charset=utf-8')
|
return HttpResponse('\n'.join(ls) + '\n', content_type='text/plain; charset=utf-8')
|
||||||
|
|
||||||
|
|
||||||
def default_ovvpfile(event, rocnik):
|
|
||||||
of = OvvpFile()
|
|
||||||
of.headers['version'] = '1'
|
|
||||||
of.headers['event'] = event
|
|
||||||
of.headers['year'] = force_text(rocnik.prvni_rok)
|
|
||||||
of.headers['date'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
||||||
of.headers['id-scope'] = 'mam'
|
|
||||||
of.headers['id-generation'] = '1'
|
|
||||||
return of
|
|
||||||
|
|
||||||
|
|
||||||
class ExportSousView(generic.View):
|
class ExportSousView(generic.View):
|
||||||
|
|
||||||
def get(self, request, datum_zacatku=None):
|
def get(self, request, datum_zacatku=None):
|
|
@ -137,6 +137,7 @@ INSTALLED_APPS = (
|
||||||
'various',
|
'various',
|
||||||
'various.autentizace',
|
'various.autentizace',
|
||||||
'api',
|
'api',
|
||||||
|
'aesop',
|
||||||
|
|
||||||
# Admin upravy:
|
# Admin upravy:
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,9 @@ urlpatterns = [
|
||||||
# Api (ma vlastni podadresare) (autocomplete apod.)
|
# Api (ma vlastni podadresare) (autocomplete apod.)
|
||||||
path('', include('api.urls')),
|
path('', include('api.urls')),
|
||||||
|
|
||||||
|
# Aesop (ma vlastni podadresare)
|
||||||
|
path('', include('aesop.urls')),
|
||||||
|
|
||||||
# Comments (interni i verejne)
|
# Comments (interni i verejne)
|
||||||
path('comments_dj/', include('django_comments.urls')),
|
path('comments_dj/', include('django_comments.urls')),
|
||||||
path('comments_fl/', include('fluent_comments.urls')),
|
path('comments_fl/', include('fluent_comments.urls')),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.urls import path, include, re_path
|
from django.urls import path, include, re_path
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from . import views, export
|
from . import views
|
||||||
from .utils import org_required, resitel_required, viewMethodSwitch, resitel_or_org_required
|
from .utils import org_required, resitel_required, viewMethodSwitch, resitel_or_org_required
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
@ -67,23 +67,6 @@ urlpatterns = [
|
||||||
path('archiv/clanky/', views.ClankyResitelView.as_view(), name='clanky_resitel'),
|
path('archiv/clanky/', views.ClankyResitelView.as_view(), name='clanky_resitel'),
|
||||||
#path('clanky/org/', views.ClankyOrganizatorView.as_view(), name='clanky_organizator'),
|
#path('clanky/org/', views.ClankyOrganizatorView.as_view(), name='clanky_organizator'),
|
||||||
|
|
||||||
# Aesop
|
|
||||||
path(
|
|
||||||
'aesop-export/mam-rocnik-<int:prvni_rok>.csv',
|
|
||||||
export.ExportRocnikView.as_view(),
|
|
||||||
name='seminar_export_rocnik'
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
'aesop-export/mam-sous-<str:datum_zacatku>.csv',
|
|
||||||
export.ExportSousView.as_view(),
|
|
||||||
name='seminar_export_sous'
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
'aesop-export/index.csv',
|
|
||||||
export.ExportIndexView.as_view(),
|
|
||||||
name='seminar_export_index'
|
|
||||||
),
|
|
||||||
|
|
||||||
# Stranky viditelne pouze pro orgy:
|
# Stranky viditelne pouze pro orgy:
|
||||||
path(
|
path(
|
||||||
'rocnik/<int:rocnik>/vysledkovka.tex',
|
'rocnik/<int:rocnik>/vysledkovka.tex',
|
||||||
|
|
Loading…
Reference in a new issue