Re: Django Admin - ModelAdmin exclude

2015-09-12 Thread Luke Plant
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

Re: Django Admin - ModelAdmin exclude

2015-09-03 Thread Tim Graham
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

Re: Django Admin - ModelAdmin exclude

2015-09-02 Thread Ramez Ashraf
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

Re: Django Admin - ModelAdmin exclude

2015-06-19 Thread Luke Plant
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

Re: Django Admin - ModelAdmin exclude

2015-06-13 Thread Peter Farrell
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

Re: Django Admin - ModelAdmin exclude

2015-06-10 Thread Tim Graham
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

Re: Django Admin - ModelAdmin exclude

2015-06-06 Thread Peter J. Farrell
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

Re: Django Admin - ModelAdmin exclude

2015-06-06 Thread Marc Tamlyn
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

Django Admin - ModelAdmin exclude

2015-06-06 Thread Peter Farrell
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