mirror of
https://github.com/django/django.git
synced 2025-09-22 18:22:40 +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:
parent
a718fcf201
commit
eefc88feef
15 changed files with 228 additions and 29 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue