I have an app for forum. It has three classes Tag, Question and Answer.
models:
class Tag(models.Model):
tag_name = models.CharField(max_length=100)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = models.DateTimeField(auto_now_add=True, auto_now=False)
description = models.TextField()
def __unicode__(self):
return smart_unicode(self.tag_name)
class Question(models.Model):
short_description = models.CharField(max_length=250)
description = models.TextField()
asked_by = models.ForeignKey(User)
tags = models.ManyToManyField(Tag)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = models.DateTimeField(auto_now_add=True, auto_now=False)
def __unicode__(self):
return smart_unicode(self.short_description)
class Answer(models.Model):
description = models.TextField()
for_question = models.ForeignKey(Question)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = models.DateTimeField(auto_now_add=True, auto_now=False)
def __unicode__(self):
return smart_unicode(self.description)
I also want to have comments for Question, Answers and also for other parts of my apps. What is the best way to achieve this? I mean, what is the right way to design the django models for this use case? Do I have to use content types for this? Please guide me how to achieve the above mentioned. Your help will be much appreciated. Thank you.