Generic field because on my project you can post and comment in Blogs, Gallery pages, Foto pages, video pages, ecc. So I want to use my Post_comment models for post and comment anythings. Is this a wrong solution ? Are there problems with the performances ?
Thanks ;) -------- On 25 Mag, 12:19, Scott Gould <zinck...@gmail.com> wrote: > Presumably you want the same object to be able to be a comment on > someone else's post as well as a post in it's own right, that others > could comment on? Looks straightforward enough, though I can't see why > you'd need the generic fields in the model. > > Regards > Scott > > On May 25, 5:54 am, nameless <xsatelli...@gmail.com> wrote: > > > > > > > I have created a simple project where everyone can create one or more > > Blog. I want to use this models for Post and for Comment: > > > class Post_comment(models.Model): > > content_type = models.ForeignKey(ContentType) > > object_id = models.PositiveIntegerField(_('object ID')) > > content_object = generic.GenericForeignKey() > > > # Hierarchy Field > > parent = models.ForeignKey('self', null=True, blank=True, > > default=None, related_name='children') > > > # User Field > > user = models.ForeignKey(User) > > > # Date Fields > > date_submitted = models.DateTimeField(_('date/time submitted'), > > default = datetime.now) > > date_modified = models.DateTimeField(_('date/time modified'), > > default = datetime.now) > > > title = models.CharField(_('title'), max_length=60, blank=True, > > null=True) > > post_comment = models.TextField(_('post_comment')) > > > if it is a comment the parent is not null. So in most case the text > > field will contain a little bit of text. Can I use this model for both > > Post and Comment ? Is it a good solution ? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.