Commit e51cbd9700900d25180a9f42e649cb4274d882ce

Authored by =yeago
1 parent 92e28fb9

inspect comment class differently

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