Hi,

I have a model called Link that allows the user to save a URL with a
title and description. The website i am making is full of Links users
have added (like a bookmarking service)

class Link(models.Model):
    user = models.ForeignKey(User)
    title = models.CharField(max_length=200)
    link = models.URLField(verify_exists=True)
    pub_date = models.DateTimeField('Date Published')

Other users can save their favourite links that they see on the site.
For this i created a SaveLink model

class SaveLink(models.Model):
    user = models.ForeignKey(User)
    link = models.ForeignKey(Link)
    save_date = models.DateTimeField(auto_now=True)

On the users profile page i want to list the links they added as their
favourites, so i need the user and link fields from the SaveLink model
and i also want to show the title and pub_date fields from the Link
model.

Currently my view looks like

links = SaveLink.objects.filter(user=request.user).order_by('-
save_date')

But how can i access fields from both the SaveLink model and Link
model in the queryset ?

Sorry for the noob question !!

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to