Suppose this is a model for an app Blog:
class Blog(models.Model):
title = models.CharField(max_length=200)
pub_date = models.DateTimeField(default=datetime.now)
creator = models.ForeignKey(User)
content = BleachField()
And this is another model for an app Status:
class Status(models.Model):
content = BleachField()
pub_date = models.DateTimeField(default=datetime.now)
creator = models.ForeignKey(User)
How do I come up with something like this:
from blog.models import Blog
from status.models import Status
blog = Blog.objecs.all()
status = Status.objects.all()
all = blog | status
And display all the updates for the user in the template.
updates = user.all_set.all()
Edit:
So that in the templates I can do, something like this:
{% for each in all %}
....
{% endfor %}
What I wan't is that, in the home page, I would like to display the updates of all the user's activity in the latest order,
Eg:
'User updated with new status: blah blah'
'User published a new Blog'
'User published a new Blog'
like in many other social networking sites. And not to display them both separately. And similarly in the user's profile, display all the activities of that particular User.