# HG changeset patch # User durandn # Date 1476970247 -7200 # Node ID b7c007c10abe0b0dee8e2307cc515c567f95b956 # Parent 9c9abc933135224d35fec8802f560043cd9f0b46 images in item lists are now ordered by name to preserve naming convention logic at the very least, before implementing a better alternative #36 diff -r 9c9abc933135 -r b7c007c10abe src/iconolab/models.py --- a/src/iconolab/models.py Thu Oct 20 15:15:44 2016 +0200 +++ b/src/iconolab/models.py Thu Oct 20 15:30:47 2016 +0200 @@ -53,6 +53,10 @@ def __str__(self): return str(self.item_guid)+":from:"+self.collection.name + @property + def images_sorted_by_name(self): + return self.images.order_by("-name").all() + class ItemMetadata(models.Model): item = models.OneToOneField('Item', related_name='metadatas') authors = models.CharField(max_length=255, default="") diff -r 9c9abc933135 -r b7c007c10abe src/iconolab/templates/iconolab/collection_home.html --- a/src/iconolab/templates/iconolab/collection_home.html Thu Oct 20 15:15:44 2016 +0200 +++ b/src/iconolab/templates/iconolab/collection_home.html Thu Oct 20 15:30:47 2016 +0200 @@ -186,7 +186,7 @@
Détail de l'objet
- {% include "partials/item-images-preview.html" with item=item %} + {% include "partials/item_images_preview.html" with item=item %} {% endfor %} diff -r 9c9abc933135 -r b7c007c10abe src/iconolab/templates/partials/item-images-preview.html --- a/src/iconolab/templates/partials/item-images-preview.html Thu Oct 20 15:15:44 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -{% load thumbnail %} - -
- {% if item.images.count > 1 %} - {% with item.images.first as main_image %} - {% if main_image.wh_ratio < 1.3 %} - - {% else %} - - {% endif %} - {% endwith %} - {% else %} - {% with item.images.first as main_image %} - - {% endwith %} - {% endif %} -
\ No newline at end of file diff -r 9c9abc933135 -r b7c007c10abe src/iconolab/templates/partials/item_images_preview.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/iconolab/templates/partials/item_images_preview.html Thu Oct 20 15:30:47 2016 +0200 @@ -0,0 +1,65 @@ +{% load thumbnail %} + +
+ {% if item.images.count > 1 %} + {% with item.images_sorted_by_name.first as main_image %} + {% if main_image.wh_ratio < 1.3 %} + + {% else %} + + {% endif %} + {% endwith %} + {% else %} + {% with item.images.first as main_image %} + + {% endwith %} + {% endif %} +
\ No newline at end of file diff -r 9c9abc933135 -r b7c007c10abe src/iconolab/templates/search/image_search.html --- a/src/iconolab/templates/search/image_search.html Thu Oct 20 15:15:44 2016 +0200 +++ b/src/iconolab/templates/search/image_search.html Thu Oct 20 15:30:47 2016 +0200 @@ -34,7 +34,7 @@ {% for item in page_obj.object_list %}
  • - {% include "partials/item-images-preview.html" with item=item.object %} + {% include "partials/item_images_preview.html" with item=item.object %}

    Métadonnées de l'objet