diff options
| author | Tim Graham <timograham@gmail.com> | 2015-12-24 10:25:59 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-12-29 12:49:14 -0500 |
| commit | dbb0df2a0ec5bee80bee336fc81408efb30b7e47 (patch) | |
| tree | b01db970481415e3fdc0789d95252ff7d0a673ac /docs/topics | |
| parent | 300de968d680eea10daa00132f60b7db47abfe1d (diff) | |
Fixed #25985 -- Updated signature of ModelAdmin.formfield_for_* to make request a positional argument.
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/db/multi-db.txt | 16 |
1 files changed, 8 insertions, 8 deletions
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:: |
