I have models similar to following:

class User(models.Model):
   name = models.CharField(maxlength=100)

class Keyword(models.Model):
   name = models.CharField(maxlength=100)
   user = models.ForeignKey(User)

class Article(models.Model):
   name = models.CharField(maxlength=100)
   user = models.ForeignKey(User)
   keywords = model.ManyToManyField(Keyword,
filter_interface=models.HORIZONTAL)

Admin works but displays on Article edit page Keywords of all users,
while I want it to display Keywords only of the same User only.

I tried 'limit_choices_to', but with no success because I can't pass
in(or can't find how to do it) edited article instance, and therefore
access it's user__id

I tried subclassing ManyToManyFIeld and overriding it
get_choices_default() but with no success because it is supposed to be
class attribute.

Perhaps it has to do something with ForeignRelatedObjectsDescriptor and
such, but google finds surprisingly little on this subject.

Perhaps it's a trvial problem but I am new to Django so any help will
be appreciated.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to