Skip to content

Commit

Permalink
Pokus o operavenie nekonzistentných komentárov v db
Browse files Browse the repository at this point in the history
  • Loading branch information
mireq committed Oct 5, 2019
1 parent e7d8cde commit 3a2bbc1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion comments/templatetags/comments_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ def target_ctype(self):
def root_header(self):
object_id = self.target.pk
ctype = self.target_ctype
return RootHeader.objects.get(content_type=ctype, object_id=object_id)
try:
return RootHeader.objects.get(content_type=ctype, object_id=object_id)
except RootHeader.DoesNotExist:
Comment.objects.get_or_create_root_comment(ctype, object_id)
return RootHeader.objects.get(content_type=ctype, object_id=object_id)

def get_queryset(self):
object_id = self.target.pk
Expand Down

0 comments on commit 3a2bbc1

Please sign in to comment.