Fixed #11639, #13618 -- Added get_prepopulated_fields method to ModelAdmin and InlineModelAdmin to be able to handle prepopulated fields on a case-by-case basis. Thanks, leanmeandonothingmachine.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16069 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2011-04-22 12:02:25 +00:00
parent 51cfd7a50b
commit 6c17190bf8
6 changed files with 110 additions and 11 deletions

View file

@ -839,6 +839,15 @@ templates used by the :class:`ModelAdmin` views:
a ``list`` or ``tuple`` of field names that will be displayed as read-only,
as described above in the :attr:`ModelAdmin.readonly_fields` section.
.. method:: ModelAdmin.get_prepopulated_fields(self, request, obj=None)
.. versionadded:: 1.4
The ``get_prepopulated_fields`` method is given the ``HttpRequest`` and the
``obj`` being edited (or ``None`` on an add form) and is expected to return
a ``dictionary``, as described above in the :attr:`ModelAdmin.prepopulated_fields`
section.
.. method:: ModelAdmin.get_urls(self)
The ``get_urls`` method on a ``ModelAdmin`` returns the URLs to be used for