Showing
2 changed files
with
4 additions
and
4 deletions
| ... | ... | @@ -40,13 +40,13 @@ def get_comment_app_name(): |
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | def get_model(): |
| 43 | - from django_comments.models import Comment | |
| 44 | 43 | """ |
| 45 | 44 | Returns the comment model class. |
| 46 | 45 | """ |
| 47 | 46 | if get_comment_app_name() != DEFAULT_COMMENTS_APP and hasattr(get_comment_app(), "get_model"): |
| 48 | 47 | return get_comment_app().get_model() |
| 49 | 48 | else: |
| 49 | + from django_comments.models import Comment | |
| 50 | 50 | return Comment |
| 51 | 51 | |
| 52 | 52 | ... | ... |
| ... | ... | @@ -4,7 +4,6 @@ from django.contrib import admin |
| 4 | 4 | from django.contrib.auth import get_user_model |
| 5 | 5 | from django.utils.translation import ugettext_lazy as _, ungettext |
| 6 | 6 | |
| 7 | -from django_comments.models import Comment | |
| 8 | 7 | from django_comments import get_model |
| 9 | 8 | from django_comments.views.moderation import perform_flag, perform_approve, perform_delete |
| 10 | 9 | |
| ... | ... | @@ -90,5 +89,6 @@ class CommentsAdmin(admin.ModelAdmin): |
| 90 | 89 | |
| 91 | 90 | # Only register the default admin if the model is the built-in comment model |
| 92 | 91 | # (this won't be true if there's a custom comment app). |
| 93 | -if get_model() is Comment: | |
| 94 | - admin.site.register(Comment, CommentsAdmin) | |
| 92 | +Klass = get_model() | |
| 93 | +if Klass._meta.app_label is "django_comments": | |
| 94 | + admin.site.register(Klass, CommentsAdmin) | ... | ... |
Please
register
or
login
to post a comment