diff --git a/pfwb_thesaurus/settings.py b/pfwb_thesaurus/settings.py index e4b9b59..725e432 100644 --- a/pfwb_thesaurus/settings.py +++ b/pfwb_thesaurus/settings.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + """ Django settings for pfwb_thesaurus project. @@ -97,6 +99,14 @@ STATICFILES_DIRS = ( TABELLIO_DB_SETTINGS = {} +HOMEPAGE_START_TERMS = ["matières culturelles", + "politique de la santé", + "budget et finances publiques", + "fonction publique", + "enseignement", + "aide aux personnes", + "recherche scientifique", + "relations extérieures"] local_settings_file = os.environ.get('PFWB_THESAURUS_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')) diff --git a/pfwb_thesaurus/static/css/style.css b/pfwb_thesaurus/static/css/style.css new file mode 100644 index 0000000..7fe24e8 --- /dev/null +++ b/pfwb_thesaurus/static/css/style.css @@ -0,0 +1,3 @@ +table td { + vertical-align: top; +} diff --git a/pfwb_thesaurus/templates/thesaurus/term_detail.html b/pfwb_thesaurus/templates/thesaurus/term_detail.html new file mode 100644 index 0000000..66b3fb9 --- /dev/null +++ b/pfwb_thesaurus/templates/thesaurus/term_detail.html @@ -0,0 +1,77 @@ +{% extends "base.html" %} + +{% block content %} + + + + + + + + + + + + +
+
+

TG (Termes génériques)

+ {% if object.broader.count %} +
    + {% for term in object.broader.all %} +
  • {{term.term}}
  • + {% endfor %} +
+ {% else %} + néant + {% endif %} +
+

{{object.term}}

+ {% if object.alternativeterm_set.count %} +
+

Employé pour (équivalences)

+
    + {% for alt in object.alternativeterm_set.all %} +
  • [{{alt.term}}]
  • + {% endfor %} +
+
+ {% endif %} + {% if object.historical_note %} +
+

{{ object.historical_note }}

+
+ {% endif %} + +
+
+

TA (Termes associés — Voir aussi)

+ {% if object.related.count %} +
    + {% for term in object.related.all %} +
  • {{term.term}}
  • + {% endfor %} +
+ {% else %} + néant + {% endif %} + +
+
+
+

TS (Termes spécifiques)

+ {% if object.narrower.count %} +
    + {% for term in object.narrower.all %} +
  • {{term.term}}
  • + {% endfor %} +
+ {% else %} + néant + {% endif %} + +
+
+ + +{% endblock %} diff --git a/pfwb_thesaurus/templates/thesaurus/term_list.html b/pfwb_thesaurus/templates/thesaurus/term_list.html new file mode 100644 index 0000000..86025d4 --- /dev/null +++ b/pfwb_thesaurus/templates/thesaurus/term_list.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% block content %} +

Points d'entrée

+ + + +{% endblock %} diff --git a/pfwb_thesaurus/urls.py b/pfwb_thesaurus/urls.py index 388c9ae..fd8bcbc 100644 --- a/pfwb_thesaurus/urls.py +++ b/pfwb_thesaurus/urls.py @@ -2,9 +2,7 @@ from django.conf.urls import patterns, include, url from django.contrib import admin urlpatterns = patterns('', - # Examples: - # url(r'^$', 'pfwb_thesaurus.views.home', name='home'), - # url(r'^blog/', include('blog.urls')), - + url(r'^$', 'pfwb_thesaurus.views.home', name='home'), + url(r'^term/(?P\w+)$', 'pfwb_thesaurus.views.term', name='term'), url(r'^admin/', include(admin.site.urls)), ) diff --git a/pfwb_thesaurus/views.py b/pfwb_thesaurus/views.py new file mode 100644 index 0000000..1a9f66e --- /dev/null +++ b/pfwb_thesaurus/views.py @@ -0,0 +1,35 @@ +# 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 . + +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 TermView(DetailView): + model = Term + +term = TermView.as_view()