Hi,
(was
http://groups.google.com/group/django-developers/browse_thread/thread/1695343f1e5cdc36/f4918ceac3a2f246)
I answer myself since I have submitted a new patch[1] that behaves
like Adrian suggested it:
# Model
class Book(models.Model):
title = models.CharField(maxlength=100)
author = models.ManyToManyField(Author)
editor = models.ForeignKey(Editor)
# Admin
class BookAdmin(ModelAdmin):
def dynamic_author_choices(self, request, author):
# Default implementation:
# return author.objects.all()
return author.objects.filter(author_of_books=True)
def dynamic_editor_choices(self, request, editor):
# Only display editors which are bound (with a FK or any other
# related field) to a group in which the user is.
# Disclaimer: actually, I have not tested this example,
# so it may be wrong ;-)
return
editor.objects.filter(group__in=request.user.groups.all())
What do you think about this feature ?
Regards,
Baptiste
[1]: http://code.djangoproject.com/attachment/ticket/3987/diff-dynamic.3.diff
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---