Hello,
Suppose this is a model for a user's photo:
class Photo(models.Model):
user = models.ForeignKey(User)
title = models.CharField()
image = models.ImageField()
pub_date = models.DateTimeFied(auto_now=True, auto_now_add=pub_date)
update = models.DateTimeFied(auto_now=False, auto_now_add=True)
This is another model for user's status:
class Status(models.Model):
user = models.ForeignKey(User)
tweet = models.TextFied()
pub_date = models.DateTimeFied(auto_now=True, auto_now_add=pub_date)
Now, this is a model for all the feeds of a user:
class StreamItem(models.Model):
user = models.ForeignKey(User)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type','object_id')
1. In the above class '*StreamItem*', is the *content_type *the data_type
of the instance?
2. What is *object_id*? Is it the pk of the instance or the pk for that
StramItem instance?
3. Lastly, is how do I get the pub_date of the above two class instance
(Photo and Status) and initialize it to the StreamItem instance?
I hope I made myself clear. I really need to know about content types. I
will really appreciate if you could help me understand.
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 [email protected].
To post to this group, send email to [email protected].
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-nGqh4phgzjbiGpZ4SQpn356L6CwebGrd%3DPSGaHMnP1imkg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.