My initial reaction:
The docs, with Tim's correction, will look like:
The ``get_exclude`` method is given the ``HttpRequest`` and the ``obj``
being edited and is expected to return a list of fields, as described
above in the :attr:`ModelAdmin.exclude` section.
However, the default
A pull request has been offered: https://github.com/django/django/pull/5214
It seems simple enough to me. Marc or Luke, would you withdraw your
objection after seeing the implementation?
On Wednesday, September 2, 2015 at 7:09:18 AM UTC-4, Ramez Ashraf wrote:
>
> I agree that there are a lot of
I agree that there are a lot of of hooks in the admin and we might need to
better document them or remove unneeded or maybe make a revolution :)
But, with the current api and scheme, having get_exclude is more of the
expected behavior of Django and i think it should be implemented.
What we
I agree with Marc on this one - I remember doing the work to change
"ModelForm.fields" so that you needed "__all__" to indicate everything,
instead of defaulting to all. This was a nightmare precisely because of
the different number of ways of defining the fields. This is partly the
result of
I agree there are many ways to accomplishing things in the admin, but
cleaning that up and continuing BC is a completely other ticket /
implementation (it looks like a good Sumer of Code project similar to the
Meta API recently completed). Since the ticket was marked as accepted,
I'll double
I agree with Marc that so many ways to do things isn't ideal, but I don't
see a different simple way to accommodate Peter's use case, so +0 to adding
get_exclude().
On Saturday, June 6, 2015 at 11:44:53 AM UTC-4, Peter J. Farrell wrote:
>
> In our case, we need to dynamically include additional
In our case, we need to dynamically include additional "exclude" fields in
our VersionableAdmin and not override the selections the developer has set
in their subclass. There are two options to accomplished this:
1) Override get_form() which is messy because you can't just call super
here and
I don't think we should add this. Exclude is passed to the form, and we
already have a way of changing the form based on the request. I'd rather
see changes made to reduce some of the many many ways to select fields in
the admin. By my count at present we have:
ModelAdmin.fields
We are writing a custom admin for CleanerVersion that subclasses ModelAdmin.
Just about every attribute has a hook method which makes extension easier. For
example, list_display has get_list_display(). However, exclude doesn't have one
implemented and it seems like an oversight. I'm proposing