This question seems to have been asked a few times, but never answered
fully.
I am looking to query more than one table, but return the results to a
template as one queryset ordered by date.
The reason i'm doing this is to create a single queryset including
information from a blog table, twitter table and delicious table to be
displayed as a sort of log of my online activity sorted by date.
the blog post model:
class Post(models.Model):
slug = models.SlugField(unique=True)
tags = TagField()
title = models.CharField(max_length=80)
pubdate = models.DateTimeField(default=datetime.datetime.now)
modifieddate = models.DateTimeField(auto_now=True)
body = models.TextField()
draft = models.BooleanField(default=True)
closed = models.BooleanField()
the delicious model (taken from syncr app)
class Bookmark(models.Model):
# description, href, tags, extended, dt
description = models.CharField(max_length=250, blank=True)
url = models.URLField(unique=True)
tags = TagField()
extended_info = models.TextField(blank=True)
post_hash = models.CharField(max_length=100)
saved_date = models.DateTimeField()
the twitter model (taken from syncr app)
class Tweet(models.Model):
pub_time = models.DateTimeField()
twitter_id = models.PositiveIntegerField()
text = models.TextField()
user = models.ForeignKey('TwitterUser')
I'd like to get these into one queryset, possibly including a field
that indicates what type of listing is being displayed. Obviously I
dont need all of the fields from each of the models, just enough to
display the title and a possible link.
Thanks in adance, hope someone can help me out, I don't know where to
start with this.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---