summaryrefslogtreecommitdiff
path: root/app/lib
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/django_comments/__init__.py5
-rw-r--r--app/lib/django_comments/models.py7
-rw-r--r--app/lib/django_comments/views/comments.py6
3 files changed, 11 insertions, 7 deletions
diff --git a/app/lib/django_comments/__init__.py b/app/lib/django_comments/__init__.py
index f369ac6..225b195 100644
--- a/app/lib/django_comments/__init__.py
+++ b/app/lib/django_comments/__init__.py
@@ -3,9 +3,6 @@ from django.core import urlresolvers
from django.core.exceptions import ImproperlyConfigured
from importlib import import_module
-from django_comments.models import Comment
-from django_comments.forms import CommentForm
-
DEFAULT_COMMENTS_APP = 'django_comments'
def get_comment_app():
@@ -35,6 +32,7 @@ def get_comment_app_name():
return getattr(settings, 'COMMENTS_APP', DEFAULT_COMMENTS_APP)
def get_model():
+ from django_comments.models import Comment
"""
Returns the comment model class.
"""
@@ -44,6 +42,7 @@ def get_model():
return Comment
def get_form():
+ from django_comments.forms import CommentForm
"""
Returns the comment ModelForm class.
"""
diff --git a/app/lib/django_comments/models.py b/app/lib/django_comments/models.py
index 78ce8b8..6ba1f30 100644
--- a/app/lib/django_comments/models.py
+++ b/app/lib/django_comments/models.py
@@ -1,5 +1,8 @@
from django.conf import settings
-from django.contrib.contenttypes.fields import GenericForeignKey
+try:
+ from django.contrib.contenttypes.fields import GenericForeignKey
+except ImportError:
+ from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.core import urlresolvers
@@ -79,7 +82,6 @@ class Comment(BaseCommentAbstractModel):
permissions = [("can_moderate", "Can moderate comments")]
verbose_name = _('comment')
verbose_name_plural = _('comments')
- app_label = _('comment')
def __str__(self):
return "%s: %s..." % (self.name, self.comment[:50])
@@ -191,7 +193,6 @@ class CommentFlag(models.Model):
unique_together = [('user', 'comment', 'flag')]
verbose_name = _('comment flag')
verbose_name_plural = _('comment flags')
- app_label = _('commentflag')
def __str__(self):
return "%s flag of comment ID %s by %s" % \
diff --git a/app/lib/django_comments/views/comments.py b/app/lib/django_comments/views/comments.py
index 92084b6..b44babf 100644
--- a/app/lib/django_comments/views/comments.py
+++ b/app/lib/django_comments/views/comments.py
@@ -10,6 +10,10 @@ from django.template.loader import render_to_string
from django.utils.html import escape
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.http import require_POST
+try:
+ from django.apps import apps
+except ImportError:
+ from django.db import models as apps
import django_comments
from django_comments import signals
@@ -49,7 +53,7 @@ def post_comment(request, next=None, using=None):
if ctype is None or object_pk is None:
return CommentPostBadRequest("Missing content_type or object_pk field.")
try:
- model = models.get_model(*ctype.split(".", 1))
+ model = apps.get_model(*ctype.split(".", 1))
target = model._default_manager.using(using).get(pk=object_pk)
except TypeError:
return CommentPostBadRequest(