mirror of
https://github.com/django/django.git
synced 2025-05-30 02:36:29 +00:00
Removed unused ForeignObjectRel.get_choices() limit_to_currently_related argument.
Unused since its introduction in dc334a2ba8dbf5134d65c97fea2785c3b2294ef5.
This commit is contained in:
parent
5e1d45b1ca
commit
2da7f5afcf
@ -130,8 +130,7 @@ class ForeignObjectRel(object):
|
|||||||
self.related_model._meta.model_name,
|
self.related_model._meta.model_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_choices(self, include_blank=True, blank_choice=BLANK_CHOICE_DASH,
|
def get_choices(self, include_blank=True, blank_choice=BLANK_CHOICE_DASH):
|
||||||
limit_to_currently_related=False):
|
|
||||||
"""
|
"""
|
||||||
Return choices with a default blank choices included, for use as
|
Return choices with a default blank choices included, for use as
|
||||||
SelectField choices for this field.
|
SelectField choices for this field.
|
||||||
@ -139,14 +138,9 @@ class ForeignObjectRel(object):
|
|||||||
Analog of django.db.models.fields.Field.get_choices(), provided
|
Analog of django.db.models.fields.Field.get_choices(), provided
|
||||||
initially for utilization by RelatedFieldListFilter.
|
initially for utilization by RelatedFieldListFilter.
|
||||||
"""
|
"""
|
||||||
first_choice = blank_choice if include_blank else []
|
return (blank_choice if include_blank else []) + [
|
||||||
queryset = self.related_model._default_manager.all()
|
(x._get_pk_val(), smart_text(x)) for x in self.related_model._default_manager.all()
|
||||||
if limit_to_currently_related:
|
]
|
||||||
queryset = queryset.complex_filter(
|
|
||||||
{'%s__isnull' % self.related_model._meta.model_name: False}
|
|
||||||
)
|
|
||||||
lst = [(x._get_pk_val(), smart_text(x)) for x in queryset]
|
|
||||||
return first_choice + lst
|
|
||||||
|
|
||||||
def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False):
|
def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False):
|
||||||
# Defer to the actual field definition for db prep
|
# Defer to the actual field definition for db prep
|
||||||
|
Loading…
x
Reference in New Issue
Block a user