You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.0 KiB
36 lines
1.0 KiB
# -*- coding: utf-8 -*-
|
|
from django.http import HttpResponse
|
|
from models import Service
|
|
from functions.custom_views import ExpoListView
|
|
from django.views.generic import ListView, FormView, TemplateView
|
|
from haystack.query import EmptySearchQuerySet
|
|
from django.shortcuts import get_object_or_404
|
|
from django.http import Http404
|
|
import json
|
|
from functions.search_forms import CompanySearchForm
|
|
|
|
from order_forms import TranslationForm, CatalogForm, VisitForm, RemoteForm, ParticipationForm, TicketsForm
|
|
|
|
|
|
order_forms = {'translator': TranslationForm, 'catalog': CatalogForm, 'participation': ParticipationForm,
|
|
'remote': RemoteForm, 'tickets': TicketsForm, 'visit': VisitForm}
|
|
|
|
class ServiceView(FormView):
|
|
|
|
def get_form_class(self):
|
|
url = self.kwargs.get('url')
|
|
form = order_forms.get(url)
|
|
if form:
|
|
return form
|
|
else:
|
|
raise Http404
|
|
|
|
|
|
|
|
def get_template_names(self):
|
|
url = self.kwargs.get('url')
|
|
|
|
service = get_object_or_404(Service, url=url)
|
|
|
|
return service.template
|
|
|
|
|