I have a question about using the new formfield_for_dbfield with Django 1.1 beta 1. In this example I'm trying to filter the list of users that appears in a "speakers" field in the admin, where speakers is
speakers = models.ManyToManyField(User) Lacking docs, I've modeled it after the way I've used formfield_for_foreignkey in the past (but formfield_for_foreignkey doesn't work for manytomany fields). This example still returns all users in the system - the user list is not filtered. class PresentationAdmin(admin.ModelAdmin): def formfield_for_dbfield(self, db_field, **kwargs): formfield = super(PresentationAdmin, self).formfield_for_dbfield(db_field, **kwargs) if db_field.name == 'speakers': kwargs["queryset"] = User.objects.filter(pk=1).order_by ('username') return formfield Suggestions? 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 -~----------~----~----~----~------~----~------~--~---