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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGrBVHz9TKr_cPHfyw-488rohdp8bdMV7H844NkLeRytKA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to