Move api do aplikace api

This commit is contained in:
Jonas Havelka 2021-10-05 00:00:15 +02:00
parent dea0ef74e6
commit 4215e32954
14 changed files with 36 additions and 17 deletions

3
api/__init__.py Normal file
View file

@ -0,0 +1,3 @@
"""
Obsahuje api = autocomplete + export škol.
"""

5
api/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class ApiConfig(AppConfig):
name = 'api'

View file

1
api/tests/__init__.py Normal file
View file

@ -0,0 +1 @@
from .test_skola_autocomplete import *

19
api/urls.py Normal file
View file

@ -0,0 +1,19 @@
from django.urls import path
from . import views
from seminar.utils import org_required
urlpatterns = [
# Export škol
path('api/export/skoly/', views.exportSkolView, name='export_skoly'),
# Autocomplete
path('api/autocomplete/skola/', views.SkolaAutocomplete.as_view(), name='autocomplete_skola'),
path('api/autocomplete/resitel/', org_required(views.ResitelAutocomplete.as_view()), name='autocomplete_resitel'),
path('api/autocomplete/problem/odevzdatelny', views.OdevzdatelnyProblemAutocomplete.as_view(), name='autocomplete_problem_odevzdatelny'),
# Ceka na autocomplete v3
# path('autocomplete/organizatori/',
# org_member_required(views.OrganizatorAutocomplete.as_view()),
# name='seminar_autocomplete_organizator')
]

2
api/views/__init__.py Normal file
View file

@ -0,0 +1,2 @@
from .autocomplete import *
from .exports import *

View file

@ -1,4 +1,5 @@
from dal import autocomplete
from django.http import JsonResponse
class LoginRequiredAjaxMixin(object):
def dispatch(self, request, *args, **kwargs):

View file

@ -136,6 +136,7 @@ INSTALLED_APPS = (
'header_fotky',
'various',
'various.autentizace',
'api',
# Admin upravy:

View file

@ -26,6 +26,9 @@ urlpatterns = [
# Autentizační aplikace (ma vlastni podadresare)
path('', include('various.autentizace.urls')),
# Api (ma vlastni podadresare) (autocomplete apod.)
path('', include('api.urls')),
# Comments (interni i verejne)
path('comments_dj/', include('django_comments.urls')),
path('comments_fl/', include('fluent_comments.urls')),

View file

@ -144,14 +144,6 @@ urlpatterns = [
# Obecný view na profil -- orgům dá rozcestník, řešitelům jejich stránku
path('profil/', views.profilView, name='profil'),
# Autocomplete
path('api/autocomplete/skola/',views.SkolaAutocomplete.as_view(), name='autocomplete_skola'),
path('api/autocomplete/resitel/', org_required(views.ResitelAutocomplete.as_view()), name='autocomplete_resitel'),
path('api/autocomplete/problem/odevzdatelny',views.OdevzdatelnyProblemAutocomplete.as_view(), name='autocomplete_problem_odevzdatelny'),
# Export škol
path('api/export/skoly/', views.exportSkolView, name='export_skoly'),
path('org/add_solution', org_required(views.AddSolutionView.as_view()), name='seminar_vloz_reseni'),
path('resitel/nahraj_reseni', resitel_required(views.NahrajReseniView.as_view()), name='seminar_nahraj_reseni'),
@ -161,11 +153,6 @@ urlpatterns = [
path('', views.TitulniStranaView.as_view(), name='titulni_strana'),
path('jak-resit/', views.JakResitView.as_view(), name='jak_resit'),
# Ceka na autocomplete v3
# path('autocomplete/organizatori/',
# org_member_required(views.OrganizatorAutocomplete.as_view()),
# name='seminar_autocomplete_organizator')
path('org/reseni/', org_required(views.TabulkaOdevzdanychReseniView.as_view()), name='odevzdavatko_tabulka'),
path('org/reseni/rocnik/<int:rocnik>/', org_required(views.TabulkaOdevzdanychReseniView.as_view()), name='odevzdavatko_tabulka'),
path('org/reseni/<int:problem>/<int:resitel>/', org_required(views.ReseniProblemuView.as_view()), name='odevzdavatko_reseni_resitele_k_problemu'),

View file

@ -1,9 +1,6 @@
from .views_all import *
from .autocomplete import *
from .views_rest import *
from .odevzdavatko import *
from .exports import *
# Dočsasné views
from .docasne import *