26 lines
579 B
Python
26 lines
579 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from django.views.generic import TemplateView
|
|
|
|
from . import forms
|
|
|
|
|
|
class Demo(TemplateView):
|
|
template_name = 'zoo_nanterre/demo.html'
|
|
|
|
demo = Demo.as_view()
|
|
|
|
|
|
class Search(TemplateView):
|
|
template_name = 'zoo_nanterre/search.html'
|
|
|
|
def get_context_data(self, **kwargs):
|
|
ctx = super(Search, self).get_context_data(**kwargs)
|
|
form = forms.SearchForm(data=self.request.GET or None)
|
|
ctx['form'] = form
|
|
ctx['results'] = list(form.results()) if form.is_valid() else []
|
|
return ctx
|
|
|
|
|
|
search = Search.as_view()
|