forked from beba/foerderbarometer
fixed and unified project funding & services
This commit is contained in:
parent
c27e4c5183
commit
ec062df5f4
|
|
@ -10,18 +10,18 @@
|
|||
<strong>Projektförderung</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{% url 'projektfoerderung-unter-1000' %}">Projektförderung</a>
|
||||
<a href="{% url 'extern' type='projektfoerderung-unter-1000' %}">Projektförderung</a>
|
||||
mit einer Gesamtsumme unter 1.000,— EUR
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'extern' type='projektfoerderung-unter-1000' %}">Projektförderung</a>
|
||||
<a href="{% url 'projektfoerderung-ab-1000' %}">Projektförderung</a>
|
||||
mit einer Gesamtsumme ab 1.000,— EUR
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<strong>Serviceleistungen</strong>
|
||||
<ul>
|
||||
{% for info in types %}
|
||||
{% for info in services %}
|
||||
<li><a href="{% url 'extern' type=info.path %}">{{ info.label|striptags }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ from input.models import Library
|
|||
from input.utils.testing import create_superuser, login, request
|
||||
from input.views import TYPES
|
||||
|
||||
PATHS = {TYPES[path].code: path for path in TYPES}
|
||||
|
||||
|
||||
class AnonymousViewTestCase(TestCase):
|
||||
|
||||
|
|
@ -28,9 +30,7 @@ class AnonymousViewTestCase(TestCase):
|
|||
|
||||
@staticmethod
|
||||
def helper_url(code):
|
||||
info = next(info for info in TYPES if info.code == code)
|
||||
|
||||
return resolve_url('extern', type=info.path)
|
||||
return resolve_url('extern', type=PATHS[code])
|
||||
|
||||
def helper_extern_base(self, choice, text, data):
|
||||
url = self.helper_url(choice)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from .views import (
|
|||
deny,
|
||||
ApplicationView,
|
||||
ApplicationStartView,
|
||||
ProjectInfoView,
|
||||
ProjectFundingInfoView,
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
|
|
@ -20,7 +20,7 @@ urlpatterns = [
|
|||
path('deny/<str:choice>/<int:pk>', deny, name='deny'),
|
||||
path('extern/', include([
|
||||
path('', ApplicationStartView.as_view(), name='extern'),
|
||||
path('info/projektfoerderung-ab-1000/', ProjectInfoView.as_view(), name='info-foerderprojekt-ab-1000'),
|
||||
path('projektfoerderung-ab-1000/', ProjectFundingInfoView.as_view(), name='projektfoerderung-ab-1000'),
|
||||
path('<slug:type>/', ApplicationView.as_view(), name='extern'),
|
||||
])),
|
||||
# JavaScript translations for date widgets, etc.
|
||||
|
|
|
|||
|
|
@ -80,7 +80,11 @@ class ApplicationType(NamedTuple):
|
|||
return HELP_TEXTS.get(self.code)
|
||||
|
||||
|
||||
TYPES = [
|
||||
PROJECT_FUNDING = [
|
||||
ApplicationType(TYPE_PROJ_LT_1000, 'projektfoerderung-unter-1000', ProjectRequestForm),
|
||||
]
|
||||
|
||||
SERVICES = [
|
||||
ApplicationType(TYPE_BIB, 'bibliotheksstipendium', LibraryForm),
|
||||
ApplicationType(TYPE_ELIT, 'eliteraturstipendium', ELiteratureForm),
|
||||
ApplicationType(TYPE_MAIL, 'email', EmailForm),
|
||||
|
|
@ -90,9 +94,10 @@ TYPES = [
|
|||
ApplicationType(TYPE_TRAV, 'reisekosten', TravelForm),
|
||||
ApplicationType(TYPE_SOFT, 'softwarestipendium', SoftwareForm),
|
||||
ApplicationType(TYPE_VIS, 'visitenkarten', BusinessCardForm),
|
||||
ApplicationType(TYPE_PROJ_LT_1000, 'projektfoerderung-unter-1000', ProjectRequestForm),
|
||||
]
|
||||
|
||||
TYPES = {info.path: info for info in PROJECT_FUNDING + SERVICES}
|
||||
|
||||
|
||||
def auth_deny(choice, pk, auth):
|
||||
if choice not in MODELS:
|
||||
|
|
@ -140,10 +145,10 @@ def index(request):
|
|||
|
||||
class ApplicationStartView(TemplateView):
|
||||
template_name = 'input/forms/extern.html'
|
||||
extra_context = {'types': TYPES}
|
||||
extra_context = {'services': SERVICES}
|
||||
|
||||
|
||||
class ProjectInfoView(TemplateView):
|
||||
class ProjectFundingInfoView(TemplateView):
|
||||
template_name = 'input/info_project_funding_gt_1000.html'
|
||||
|
||||
|
||||
|
|
@ -166,8 +171,7 @@ class ApplicationView(FormView):
|
|||
def type_info(self) -> ApplicationType:
|
||||
type_path = self.kwargs['type']
|
||||
|
||||
for type_info in TYPES:
|
||||
if type_path == type_info.path:
|
||||
if type_info := TYPES.get(type_path):
|
||||
return type_info
|
||||
|
||||
raise Http404(f'"{type_path}" existiert nicht.')
|
||||
|
|
|
|||
Loading…
Reference in New Issue