From 6e001443df700eb5ebe1a4d13b2187227e502430 Mon Sep 17 00:00:00 2001 From: davin baragiotta Date: Fri, 17 Sep 2010 16:04:58 -0400 Subject: [PATCH] sites frontend --- auf_savoirs_en_partage/savoirs/globals.py | 3 ++- auf_savoirs_en_partage/savoirs/views.py | 3 +++ auf_savoirs_en_partage/sites/models.py | 3 +++ auf_savoirs_en_partage/sites/views.py | 9 +++++++++ auf_savoirs_en_partage/templates/savoirs/index.html | 14 ++++++++++++++ auf_savoirs_en_partage/templates/sites/retrieve.html | 12 ++++++++++++ auf_savoirs_en_partage/urls.py | 1 + 7 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 auf_savoirs_en_partage/templates/sites/retrieve.html diff --git a/auf_savoirs_en_partage/savoirs/globals.py b/auf_savoirs_en_partage/savoirs/globals.py index c42b596..ebaa48b 100644 --- a/auf_savoirs_en_partage/savoirs/globals.py +++ b/auf_savoirs_en_partage/savoirs/globals.py @@ -4,7 +4,8 @@ configuration = { 'max_actualite': 100, 'accueil_actualite': 5, - 'accueil_chercheur': 6, + 'accueil_chercheur': 5, + 'accueil_sites': 5, 'nombre_par_page_actualite': 10, 'resultats_par_page': 8, # pas changeable a cause de google 'accueil_evenement': 10, diff --git a/auf_savoirs_en_partage/savoirs/views.py b/auf_savoirs_en_partage/savoirs/views.py index 2b30795..fc9ce11 100644 --- a/auf_savoirs_en_partage/savoirs/views.py +++ b/auf_savoirs_en_partage/savoirs/views.py @@ -16,6 +16,7 @@ import backend_config from forms import * from models import * from chercheurs.models import Chercheur +from sites.models import Site def index (request): @@ -28,11 +29,13 @@ def index (request): except: events = [] chercheurs = Chercheur.objects.all().order_by('?')[:configuration['accueil_chercheur']] + sites = Site.objects.all().order_by('?')[:configuration['accueil_sites']] return render_to_response ("savoirs/index.html", \ Context ({"articles": articles, "events": events, "caldav_url": configuration['calendrier_publique'], "chercheurs":chercheurs, + "sites":sites, }), \ context_instance = RequestContext(request)) diff --git a/auf_savoirs_en_partage/sites/models.py b/auf_savoirs_en_partage/sites/models.py index 1ce119a..5529059 100644 --- a/auf_savoirs_en_partage/sites/models.py +++ b/auf_savoirs_en_partage/sites/models.py @@ -36,3 +36,6 @@ class Site(models.Model): # meta actif = models.BooleanField() date_maj = models.DateField(auto_now=True) + + def __unicode__(self): + return "%s" % (self.url) diff --git a/auf_savoirs_en_partage/sites/views.py b/auf_savoirs_en_partage/sites/views.py index 88a8ee1..498350c 100644 --- a/auf_savoirs_en_partage/sites/views.py +++ b/auf_savoirs_en_partage/sites/views.py @@ -11,3 +11,12 @@ def index(request): return render_to_response ("sites/index.html", \ Context (variables), context_instance = RequestContext(request)) + +def retrieve(request, id): + """Fiche du site""" + site = Site.objects.get(id=id) + variables = { 'site': site, + } + return render_to_response ("sites/retrieve.html", \ + Context (variables), + context_instance = RequestContext(request)) diff --git a/auf_savoirs_en_partage/templates/savoirs/index.html b/auf_savoirs_en_partage/templates/savoirs/index.html index b4bd601..b4031a2 100644 --- a/auf_savoirs_en_partage/templates/savoirs/index.html +++ b/auf_savoirs_en_partage/templates/savoirs/index.html @@ -62,5 +62,19 @@ {% endfor %} +
+

Sites

+ + +
{% endblock %} diff --git a/auf_savoirs_en_partage/templates/sites/retrieve.html b/auf_savoirs_en_partage/templates/sites/retrieve.html new file mode 100644 index 0000000..9b9eeb8 --- /dev/null +++ b/auf_savoirs_en_partage/templates/sites/retrieve.html @@ -0,0 +1,12 @@ +{% extends "container_base.html" %} + +{% block contenu %} +

{{ site }}

+ +
+

+Voici la fiche site de {{ site }}. +

+
+ +{% endblock %} diff --git a/auf_savoirs_en_partage/urls.py b/auf_savoirs_en_partage/urls.py index 370ac2d..9a47ad8 100644 --- a/auf_savoirs_en_partage/urls.py +++ b/auf_savoirs_en_partage/urls.py @@ -35,6 +35,7 @@ urlpatterns = patterns( (r'^espace/chercheur/(?P\d+)/$', 'chercheurs.views.perso'), (r'^sites/$', 'sites.views.index'), + (r'^sites/(?P\d+)/$', 'sites.views.retrieve'), ) if settings.DEBUG: -- 1.7.10.4