- {% thumbnail image.media "x100" crop="center" as im %}
+ {% thumbnail image.media "100x100" crop=False as im %}
{% endthumbnail %}
diff -r 4d1e369e85d4 -r 625ed1ba472f src/iconolab/templates/iconolab/collection_home.html
--- a/src/iconolab/templates/iconolab/collection_home.html Mon Jul 11 14:51:49 2016 +0200
+++ b/src/iconolab/templates/iconolab/collection_home.html Wed Jul 13 17:45:17 2016 +0200
@@ -17,14 +17,16 @@
- {% for image in item.images.all %}
- {% thumbnail image.media "x500" crop="center" as im %}
-

+ {% with item.images.first as image %}
+ {% thumbnail image.media "300x300" crop=False as im %}
+
+
+
{% endthumbnail %}
- {% endfor %}
+ {% endwith %}
{% endfor %}
diff -r 4d1e369e85d4 -r 625ed1ba472f src/iconolab/templates/iconolab/detail_annotation.html
--- a/src/iconolab/templates/iconolab/detail_annotation.html Mon Jul 11 14:51:49 2016 +0200
+++ b/src/iconolab/templates/iconolab/detail_annotation.html Wed Jul 13 17:45:17 2016 +0200
@@ -28,6 +28,11 @@
{% endthumbnail %}
+
+
+ Revoir l'objet
+ Voir les annotations sur l'image
+
diff -r 4d1e369e85d4 -r 625ed1ba472f src/iconolab/templates/partials/image_annotations_list.html
--- a/src/iconolab/templates/partials/image_annotations_list.html Mon Jul 11 14:51:49 2016 +0200
+++ b/src/iconolab/templates/partials/image_annotations_list.html Wed Jul 13 17:45:17 2016 +0200
@@ -3,33 +3,46 @@
\ No newline at end of file
diff -r 4d1e369e85d4 -r 625ed1ba472f src/iconolab/urls.py
--- a/src/iconolab/urls.py Mon Jul 11 14:51:49 2016 +0200
+++ b/src/iconolab/urls.py Wed Jul 13 17:45:17 2016 +0200
@@ -28,6 +28,7 @@
url(r'^admin/', admin.site.urls),
url(r'^home$', views.GlobalHomepageView.as_view(), name="home"),
url(r'^collections/(?P
[a-z]+)$', views.CollectionHomepageView.as_view(), name='collection_home'), # Home fond
+ url(r'^collections/(?P[a-z]+)/items/(?P[^/]+)$', views.ShowItemView.as_view(), name='item_detail'),
url(r'^collections/(?P[a-z]+)/images/(?P[^/]+)$', views.ShowImageView.as_view(), name='image_detail'),
url(r'^collections/(?P[a-z]+)/images/(?P[^/]+)/annotations/create$', login_required(views.CreateAnnotationView.as_view()), name='annotation_create'),
url(r'^collections/(?P[a-z]+)/images/(?P[^/]+)/annotations/(?P[^/]+)/detail$', views.ShowAnnotationView.as_view(), name='annotation_detail'),
diff -r 4d1e369e85d4 -r 625ed1ba472f src/iconolab/views.py
--- a/src/iconolab/views.py Mon Jul 11 14:51:49 2016 +0200
+++ b/src/iconolab/views.py Wed Jul 13 17:45:17 2016 +0200
@@ -11,7 +11,7 @@
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.conf import settings
-from iconolab.models import Annotation, AnnotationRevision, Collection, Image, IconolabComment, MetaCategory, MetaCategoryInfo
+from iconolab.models import Annotation, AnnotationRevision, Collection, Item, Image, IconolabComment, MetaCategory, MetaCategoryInfo
from iconolab.forms.annotations import AnnotationRevisionForm
import datetime
import django_comments
@@ -23,7 +23,7 @@
def get(self, request, *args, **kwargs):
context = {}
context["collections"] = Collection.objects
- return render(request, 'iconolab/home.html', context);
+ return render(request, 'iconolab/home.html', context)
class CollectionHomepageView(View, ContextMixin):
@@ -43,8 +43,35 @@
context = super(CollectionHomepageView, self).get_context_data(**kwargs)
context['collection_name'] = self.kwargs.get('collection_name', '')
context['collection'] = collection
- return render(request, 'iconolab/collection_home.html', context);
+ return render(request, 'iconolab/collection_home.html', context)
+
+
+class ShowItemView(View, ContextMixin):
+
+ def check_kwargs(self, kwargs):
+ try:
+ collection = Collection.objects.prefetch_related("items", "items__images").get(name=kwargs.get('collection_name'))
+ except Collection.DoesNotExist:
+ return False, RedirectView.as_view(url=reverse('404error'))
+ try:
+ item = Item.objects.prefetch_related("images").get(item_guid=kwargs.get('item_guid'))
+ except Item.DoesNotExist:
+ return False, RedirectView.as_view(url=reverse('404error'))
+ return True, (collection, item)
+
+ def get(self, request, *args, **kwargs):
+ success, result = self.check_kwargs(kwargs)
+ if success:
+ (collection, item) = result
+ else:
+ return result(request)
+ context = super(ShowItemView, self).get_context_data(**kwargs)
+ context['collection_name'] = self.kwargs.get('collection_name', '')
+ context['item_guid'] = self.kwargs.get('image_guid', '')
+ context['collection'] = collection
+ context['item'] = item
+ return render(request, 'iconolab/detail_item.html', context);
class ShowImageView(View, ContextMixin):
@@ -70,7 +97,7 @@
context['image_guid'] = self.kwargs.get('image_guid', '')
context['collection'] = collection
context['image'] = image
- return render(request, 'iconolab/detail_image.html', context);
+ return render(request, 'iconolab/detail_image.html', context)
class CreateAnnotationView(View, ContextMixin):