mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #2445 -- Allowed limit_choices_to attribute to be a callable.
ForeignKey or ManyToManyField attribute ``limit_choices_to`` can now be a callable that returns either a ``Q`` object or a dict. Thanks michael at actrix.gen.nz for the original suggestion.
This commit is contained in:
committed by
Tim Graham
parent
a718fcf201
commit
eefc88feef
@@ -34,7 +34,7 @@ from .models import (Article, Chapter, Child, Parent, Picture, Widget,
|
||||
UnchangeableObject, UserMessenger, Simple, Choice, ShortMessage, Telegram,
|
||||
FilteredManager, EmptyModelHidden, EmptyModelVisible, EmptyModelMixin,
|
||||
State, City, Restaurant, Worker, ParentWithDependentChildren,
|
||||
DependentChild)
|
||||
DependentChild, StumpJoke)
|
||||
|
||||
|
||||
def callable_year(dt_value):
|
||||
@@ -884,6 +884,7 @@ site.register(ParentWithDependentChildren, ParentWithDependentChildrenAdmin)
|
||||
site.register(EmptyModelHidden, EmptyModelHiddenAdmin)
|
||||
site.register(EmptyModelVisible, EmptyModelVisibleAdmin)
|
||||
site.register(EmptyModelMixin, EmptyModelMixinAdmin)
|
||||
site.register(StumpJoke)
|
||||
|
||||
# Register core models we need in our tests
|
||||
from django.contrib.auth.models import User, Group
|
||||
|
||||
Reference in New Issue
Block a user