From dbb0df2a0ec5bee80bee336fc81408efb30b7e47 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 24 Dec 2015 10:25:59 -0500 Subject: Fixed #25985 -- Updated signature of ModelAdmin.formfield_for_* to make request a positional argument. --- docs/topics/db/multi-db.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/topics/db/multi-db.txt b/docs/topics/db/multi-db.txt index bb40720573..f4b6367033 100644 --- a/docs/topics/db/multi-db.txt +++ b/docs/topics/db/multi-db.txt @@ -571,15 +571,15 @@ multiple-database support:: # Tell Django to look for objects on the 'other' database. return super(MultiDBModelAdmin, self).get_queryset(request).using(self.using) - def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + def formfield_for_foreignkey(self, db_field, request, **kwargs): # Tell Django to populate ForeignKey widgets using a query # on the 'other' database. - return super(MultiDBModelAdmin, self).formfield_for_foreignkey(db_field, request=request, using=self.using, **kwargs) + return super(MultiDBModelAdmin, self).formfield_for_foreignkey(db_field, request, using=self.using, **kwargs) - def formfield_for_manytomany(self, db_field, request=None, **kwargs): + def formfield_for_manytomany(self, db_field, request, **kwargs): # Tell Django to populate ManyToMany widgets using a query # on the 'other' database. - return super(MultiDBModelAdmin, self).formfield_for_manytomany(db_field, request=request, using=self.using, **kwargs) + return super(MultiDBModelAdmin, self).formfield_for_manytomany(db_field, request, using=self.using, **kwargs) The implementation provided here implements a multi-database strategy where all objects of a given type are stored on a specific database @@ -596,15 +596,15 @@ Inlines can be handled in a similar fashion. They require three customized metho # Tell Django to look for inline objects on the 'other' database. return super(MultiDBTabularInline, self).get_queryset(request).using(self.using) - def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + def formfield_for_foreignkey(self, db_field, request, **kwargs): # Tell Django to populate ForeignKey widgets using a query # on the 'other' database. - return super(MultiDBTabularInline, self).formfield_for_foreignkey(db_field, request=request, using=self.using, **kwargs) + return super(MultiDBTabularInline, self).formfield_for_foreignkey(db_field, request, using=self.using, **kwargs) - def formfield_for_manytomany(self, db_field, request=None, **kwargs): + def formfield_for_manytomany(self, db_field, request, **kwargs): # Tell Django to populate ManyToMany widgets using a query # on the 'other' database. - return super(MultiDBTabularInline, self).formfield_for_manytomany(db_field, request=request, using=self.using, **kwargs) + return super(MultiDBTabularInline, self).formfield_for_manytomany(db_field, request, using=self.using, **kwargs) Once you've written your model admin definitions, they can be registered with any ``Admin`` instance:: -- cgit v1.3