Hello,

Is there someone kind enought to provide me some guidance on the usage
of "limit_choices_to" in a foreign key?

my model look like this:

class Profile(meta.Model):
    user =meta.ForeignKey(User)
    pseudo = meta.CharField(maxlength=30,core=True)
    [...]
    def __repr__(self):
        return self.pseudo
    class META:
        admin = meta.Admin()
class Announce(meta.Model):
    titre = meta.CharField(maxlength=30)
    [...]
    profile =meta.ForeignKey(Profile, limit_choices_to={'user__exact' :
meta.LazyDate()})
    def __repr__(self):
        return self.titre
    class META:
        admin = meta.Admin( )

The User is the regular django.models.auth class. I would like to
filter the Profiles on the attribute user. the objective it display
only the profiles of the logged in user.

I found that it should look like somelike this:

profile =meta.ForeignKey(Profile,
limit_choices_to={'user__exact'=##?the curentuser?## :
meta.LazyDate()})

It would be great if someone can help me to complete my dict.
thank you


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to