--- a/src/iconolab/models.py Thu Jul 21 11:03:14 2016 +0200
+++ b/src/iconolab/models.py Thu Jul 21 11:05:11 2016 +0200
@@ -310,7 +310,11 @@
class IconolabComment(XtdComment):
revision = models.ForeignKey('AnnotationRevision', related_name='creation_comment', null=True, blank=True)
metacategories = models.ManyToManyField('MetaCategory', through='MetaCategoryInfo', through_fields=('comment', 'metacategory'))
-
+
+ objects = XtdComment.objects
+
+ class Meta:
+ ordering = ["thread_id", "id"]
class MetaCategory(models.Model):
collection = models.ForeignKey(Collection)
--- a/src/iconolab/settings/__init__.py Thu Jul 21 11:03:14 2016 +0200
+++ b/src/iconolab/settings/__init__.py Thu Jul 21 11:05:11 2016 +0200
@@ -63,7 +63,7 @@
COMMENTS_APP = "django_comments_xtd"
COMMENTS_XTD_MODEL = "iconolab.models.IconolabComment"
COMMENTS_XTD_FORM_CLASS = 'iconolab.forms.comments.IconolabCommentForm'
-COMMENTS_XTD_MAX_THREAD_LEVEL = 0
+COMMENTS_XTD_MAX_THREAD_LEVEL = 100
SITE_ID = 1
--- a/src/iconolab/settings/dev.py.tmpl Thu Jul 21 11:03:14 2016 +0200
+++ b/src/iconolab/settings/dev.py.tmpl Thu Jul 21 11:05:11 2016 +0200
@@ -61,7 +61,7 @@
COMMENTS_APP = "django_comments_xtd"
COMMENTS_XTD_MODEL = "iconolab.models.IconolabComment"
-COMMENTS_XTD_MAX_THREAD_LEVEL = 0
+COMMENTS_XTD_MAX_THREAD_LEVEL = 100
SITE_ID = 1
--- a/src/iconolab/templates/iconolab/detail_revision.html Thu Jul 21 11:03:14 2016 +0200
+++ b/src/iconolab/templates/iconolab/detail_revision.html Thu Jul 21 11:05:11 2016 +0200
@@ -39,7 +39,7 @@
<div class="alert alert-info" role="alert">
<span class="glyphicon glyphicon-comment" aria-hidden="true"></span>
<span class="sr-only">Info:</span>
- <b>Révision par {{ revision.author }} le {{ revision.created }}</b><br>
+ <b>Révision par {{ revision.author }} le {{ revision.created|date:"d/m/Y" }} à {{ revision.created|time:"H:i" }}</b><br>
<i class="fa fa-quote-left" aria-hidden="true"></i> {{ revision.creation_comment.first.comment }} <i class="fa fa-quote-right" aria-hidden="true"></i>
</div>
{% if revision.state == 0 and user == annotation.author %}
--- a/src/iconolab/views.py Thu Jul 21 11:03:14 2016 +0200
+++ b/src/iconolab/views.py Thu Jul 21 11:05:11 2016 +0200
@@ -6,6 +6,7 @@
from django.views.generic.base import ContextMixin
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.http import require_POST
+from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.contrib.contenttypes.models import ContentType
@@ -200,6 +201,19 @@
context['image'] = image
context['annotation'] = annotation
context['tags_data'] = annotation.current_revision.get_tags_json()
+
+ page = request.GET.get("page", 1)
+ per_page = request.GET.get("perpage", 10)
+ full_comments_list = IconolabComment.objects.for_app_models("iconolab.annotation").filter(object_pk = annotation.pk).order_by("thread_id", "-order")
+ paginator = Paginator(full_comments_list, per_page)
+ try:
+ comments_list = paginator.page(page)
+ except PageNotAnInteger:
+ comments_list = paginator.page(1)
+ except EmptyPage:
+ comments_list = paginator.page(paginator.num_pages)
+ context["comments"] = comments_list
+
return render(request, 'iconolab/detail_annotation.html', context)