-
-
+ |
+
|
@@ -32,10 +32,10 @@
{% endif %}
|
-
- {{ element.comment.submit_date|date:"d M Y H:i" }}
+ |
+ {{ element.comment.submit_date|timesince }} ago
|
-
+ |
{% if not element.comment.is_public %}
{% trans "Deleted" %}
{% elif element.comment.is_removed %}
diff --git a/wagtailcomments_xtd/utils.py b/wagtailcomments_xtd/utils.py
index eed66e5..e154cf4 100644
--- a/wagtailcomments_xtd/utils.py
+++ b/wagtailcomments_xtd/utils.py
@@ -1,4 +1,7 @@
-from django_comments_xtd.models import XtdComment
+from django_comments_xtd import get_model as get_comment_model
+
+
+XtdComment = get_comment_model()
def cleaned_tree(comments):
diff --git a/wagtailcomments_xtd/views.py b/wagtailcomments_xtd/views.py
index 684b65d..56837dd 100644
--- a/wagtailcomments_xtd/views.py
+++ b/wagtailcomments_xtd/views.py
@@ -1,9 +1,16 @@
from django.contrib import messages
-from wagtail.wagtailcore.models import Page
from django.shortcuts import redirect, render
-from django_comments_xtd.models import XtdComment
+from django_comments_xtd import get_model as get_comment_model
from django.utils.translation import ugettext as _
from wagtailcomments_xtd.utils import cleaned_tree
+try:
+ from wagtail.wagtailcore.models import Page
+except ImportError:
+ # Wagtail 2.0+
+ from wagtail.core.models import Page
+
+
+XtdComment = get_comment_model()
def pages(request):
diff --git a/wagtailcomments_xtd/wagtail_hooks.py b/wagtailcomments_xtd/wagtail_hooks.py
index 7c236c5..7397832 100644
--- a/wagtailcomments_xtd/wagtail_hooks.py
+++ b/wagtailcomments_xtd/wagtail_hooks.py
@@ -1,10 +1,21 @@
-from django.core import urlresolvers
+try:
+ # urlresolvers removed in Django 2.0:
+ from django.core.urlresolvers import reverse
+except ImportError:
+ # For Django 2.0+
+ from django.urls import reverse
from wagtailcomments_xtd import urls
-from wagtail.wagtailcore import hooks
from django.conf.urls import include, url
-from wagtail.wagtailadmin.menu import MenuItem
from django.utils.translation import ugettext_lazy as _
+try:
+ from wagtail.wagtailcore import hooks
+ from wagtail.wagtailadmin.menu import MenuItem
+except ImportError:
+ # Wagtail 2.0+
+ from wagtail.core import hooks
+ from wagtail.admin.menu import MenuItem
+
@hooks.register('register_admin_urls')
def register_admin_urls():
@@ -17,7 +28,7 @@ def register_admin_urls():
def register_styleguide_menu_item():
return MenuItem(
_('Comments'),
- urlresolvers.reverse('wagtailcomments_xtd_pages'),
+ reverse('wagtailcomments_xtd_pages'),
classnames='icon icon-fa-comments-o',
order=1000
)
|