Skip to content

Commit 51a1844

Browse files
committed
pass for_concrete_model settings to ContentType
1 parent bf9552f commit 51a1844

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

django_comments_xtd/api/frontend.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
)
1313

1414

15+
COMMENTS_FOR_CONCRETE_MODEL = \
16+
getattr(settings, 'COMMENTS_FOR_CONCRETE_MODEL', True)
17+
18+
1519
XtdComment = get_comment_model()
1620

1721

@@ -59,7 +63,9 @@ def _reverse(*args, **kwargs):
5963
return reverse(*args, **kwargs)
6064

6165
form = CommentSecurityForm(obj)
62-
ctype = ContentType.objects.get_for_model(obj)
66+
ctype = ContentType.objects.get_for_model(
67+
obj, for_concrete_model=COMMENTS_FOR_CONCRETE_MODEL,
68+
)
6369
queryset = XtdComment.objects.filter(content_type=ctype,
6470
object_pk=obj._get_pk_val(),
6571
site__pk=get_current_site_id(request),

django_comments_xtd/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ def get_comment_dict(obj):
220220
return dic_list
221221

222222

223+
XtdComment.content_object.for_concrete_model = \
224+
getattr(settings, 'COMMENTS_FOR_CONCRETE_MODEL', True)
225+
226+
223227
def publish_or_unpublish_nested_comments(comment, are_public=False):
224228
qs = get_model().norel_objects.filter(~Q(pk=comment.id),
225229
parent_id=comment.id)

0 commit comments

Comments
 (0)