what about deriving the Blog class from the Status class?

| class Status(models.Model):
        content  = BleachField()
        pub_date = models.DateTimeField(default=datetime.now)
        creator  = models.ForeignKey(User)|

|class Blog(Status):
        title=  models.CharField(max_length=200)|


bg,
Johannes

On 03.11.2013 14:01, Robin Lery wrote:
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.modelsimport  Blog
from  status.modelsimport  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()|

So that in the templates I can do, something like this:

|{%  for  eachin  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.

--
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-nGoMQWG0dhwVTbyJnW6O%2BZaJr4Qvrci1aMGYpZrtbTUukw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/52764D1E.8000203%40web.de.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to