0

I have a Django+Wagtail blog site integrated with django_comments_xtd as below:

class PostDetail(Page):
    ...


class Comment(XtdComment):
    page = models.ForeignKey('PostDetail', on_delete=models.CASCADE)

    def save(self, *args, **kwargs):
        if self.user:
            self.user_name = self.user.username
        self.page = PostDetail.objects.get(pk=self.object_pk)
        super(Comment, self).save(*args, **kwargs)

Now I am about to create another class model class SurveyPoll(Page):,

How can I apply the same Comment to the newly-created model? Should I create another comment model ?

Yan Tian
  • 377
  • 3
  • 11

1 Answers1

0

You have many options for that, simplist and cleanest is to inherit from both (Page, Comment)

Distroyer
  • 11
  • 6