This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
pfwb_thesaurus/pfwb_thesaurus/views.py

42 lines
1.2 KiB
Python

# pfwb_thesaurus - thesaurus system
# Copyright (C) 2016 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.views.generic import DetailView, ListView
from django.conf import settings
from .thesaurus.models import Term
class HomeView(ListView):
model = Term
def get_queryset(self, qs=None):
return Term.objects.filter(term__in=settings.HOMEPAGE_START_TERMS)
home = HomeView.as_view()
class PlonePopupView(HomeView):
template_name = 'thesaurus/plone_popup.html'
plone_popup = PlonePopupView.as_view()
class TermView(DetailView):
model = Term
term = TermView.as_view()