Let me try to explain this a little more. Here are some example models

class Account(models.Model):
    user = models.ForeignKey(User)
    name        = models.CharField('Name on Account', max_length=100)
    description = models.CharField(max_length=100)
    date_added  = models.DateField(auto_now_add=True, blank=True)

class Payment(models.Model):
    account     = models.ForeignKey(Account)
    date_paid   = models.DateField(auto_now_add=True, blank=True)
    amount      = models.DecimalField(max_digits=10, decimal_places=2)

When I display the form for a Payment I get all of the Account
objects. I want to limit the list to accounts that the user owns. How
is this done? I have looked an I am unable to find the documentation
for it.

On Apr 27, 1:27 pm, cfiles <cpfi...@gmail.com> wrote:
> I have a model with a ForeignKeyto another model. Is it possible to filter 
> the HTML select list for the foreign object from a view?
--~--~---------~--~----~------------~-------~--~----~
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