diff options
| -rw-r--r-- | chimere/admin.py | 2 | ||||
| -rw-r--r-- | chimere/models.py | 18 | ||||
| -rw-r--r-- | chimere/templates/chimere/detail.html | 10 | 
3 files changed, 26 insertions, 4 deletions
diff --git a/chimere/admin.py b/chimere/admin.py index 63bdda3..28f768d 100644 --- a/chimere/admin.py +++ b/chimere/admin.py @@ -50,7 +50,7 @@ class MarkerAdmin(admin.ModelAdmin):      search_fields = ("name",)      list_display = ('name', 'status')      list_filter = ('status', 'categories') -    exclude = ['height', 'width'] +    exclude = []      if 'chimere_rss' in settings.INSTALLED_APPS:          exclude.append('available_date')      form = MarkerAdminForm diff --git a/chimere/models.py b/chimere/models.py index 7b08830..f33772c 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -237,6 +237,24 @@ class Marker(GeographicItem):          return self.name      @property +    def multimedia_pictures(self): +        pict = self.pictures.filter(miniature=False) +        if pict.count(): +            return pict.all() + +    @property +    def multimedia_files(self): +        mm = self.multimedia_files.filter() +        if mm.count(): +            return mm.all() + +    @property +    def default_picture(self): +        pict = self.pictures.filter(miniature=True) +        if pict.count(): +            return pict.all()[0] + +    @property      def date(self):          if settings.CHIMERE_DAYS_BEFORE_EVENT:              return self.start_date diff --git a/chimere/templates/chimere/detail.html b/chimere/templates/chimere/detail.html index 900ffe8..d88e88a 100644 --- a/chimere/templates/chimere/detail.html +++ b/chimere/templates/chimere/detail.html @@ -1,8 +1,7 @@ -{% load i18n %} -{% load sanitize %} +{% load i18n sanitize %}  <h2 class='ui-widget ui-state-default ui-corner-all ui-widget-header'>{{ marker.name }}</h2>  <div id='detail_content'> -    {% if marker.picture %}<img src='{{STATIC_URL}}{{marker.picture}}' alt='{{marker.name}}'/>{%endif%} +    {% if marker.default_picture %}<img src='{{MEDIA_URL}}{{marker.default_picture.picture}}' alt='{{marker.name}}'/>{%endif%}  <div>      {% if dated %}      <p id='detail_start_date'><label>{% trans "Date:" %}</label> <span>{{marker.start_date|date:"D d M Y"}} @@ -11,6 +10,9 @@      {% for property in marker.getProperties %}      <p id='{{property.propertymodel.getNamedId}}'>{{ property.value|sanitize:"p b i br hr strong em span:style a:href:target ul li ol h1 h2 h3 h4"|safe}}</p>      {% endfor %} +    {% if multimedia_files or multimedia_pictures %} +    <a href=''>{% trans "Show multimedia gallery" %}</a> +    {% endif %}      </div>{% if share_networks %}      {% if simple %}{% trans "Share on"%}{% for share_network in share_networks %}      <a href='{{share_network.1}}'>{{share_network.0}}</a> @@ -24,3 +26,5 @@      </a>  {% endif %}  </div> +<div id='gallery'> +</div>  | 
