hi

i'm trying to create a class that contains fields that can be inherited
by Model classes like this (User and Video also inherit from Model):

class Comment:
    author = models.ForeignKey(User)
    comment = models.TextField()
    date_commented = models.DateTimeField(auto_now_add=True)

class VideoComment(models.Model, Comment):
    video = models.ForeignKey(Video)

class UserComment(models.Model, Comment):
    user = models.ForeignKey(User)


i've also tried a variation, by declarinthe classes like this (the
contents of the classes are the same as above):

class Comment(models.Model):
class VideoComment(Comment):
class UserComment(Comment):

this does not seem right and does not work anyway.

is there a way to achieve this? or should i not bother and just do have
a Comment Model and just have VideoComment and UserComment have a
OneToOneField to Comment?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to