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 retrofitting ModelAdmin to use ModelForms, which it didn't 
originally.


Just implementing ModelAdmin.get_exclude() might prove to be extremely 
difficult to do, especially when you need to document how it interacts 
with all the other ones.


I think the problems with the false negatives for the admin checks may 
need to be solved another way - namely by removing them. That's 
unfortunate, but I found them tricky in the past - they may prevent 
common errors, but they also prevent more advanced ways that you might 
want to use the admin.


Luke

On 06/06/15 14:42, Marc Tamlyn wrote:
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
ModelAdmin.get_fields()
ModelAdmin.exclude
ModelAdmin.fieldsets
ModelAdmin.get_fieldsets()
ModelAdmin.readonly_fields
ModelAdmin.get_readonly_fields()
ModelAdmin.form concrete fields
ModelAdmin.form.Meta.fields
ModelAdmin.form.Meta.exclude
ModelAdmin.get_form()

There's an argument the only one missing here is get_exclude(), but I 
think the current API is silly. Personally, I'd like to see us moving 
towards us encouraging doing more work in the form (and defining the 
form) rather than doing so much in the ModelAdmin class. This may well 
require better support for fieldsets in django.forms.


Marc

On 6 June 2015 at 05:06, Peter Farrell > wrote:


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 we add one.

Our current work seeking is to write a property descriptor for
exclude but then the admin check fails with it not being a tuple
or list. Then you have to create a custom admin checks class to
suppress the exclude check error because it's not a tuple or list
(but really a descriptor).

If this is ok, I'Ill write a PR.

--
You received this message because you are subscribed to the Google
Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to django-developers+unsubscr...@googlegroups.com
.
To post to this group, send email to
django-developers@googlegroups.com
.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-developers/c1e8762d-1c9f-47e9-8fe7-e9761c27e057%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-developers+unsubscr...@googlegroups.com 
.
To post to this group, send email to 
django-developers@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMwjO1HKDr6T9BKf-%2B4rNm6775S7akyHfC%2BNEk4sqSDw8cOb%2Bg%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
"He knows the way I take: when he has tried me, I shall come forth
as gold" (Job 23:10).

Luke Plant || http://lukeplant.me.uk/

--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/55843AC1.4040707%40cantab.net.
For more options, visit https://groups.google.com/d/optout.


Re: does django-admin need a man page?

2015-06-19 Thread Tim Graham
Erik found a way to generate the man page automatically from 
docs/ref/django-admin.txt and this has now been merged & integrated into 
the release process. See the ticket for details: 
https://code.djangoproject.com/ticket/23903

On Friday, June 19, 2015 at 10:55:53 AM UTC-4, Luke Plant wrote:
>
>  Another argument for removing it (or trimming it down to minimum) is that 
> it's actually extensible (
> https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/ 
> ), and some packages (at least in the past) have actually changed the 
> behaviour of built in commands (e.g. 
> http://south.readthedocs.org/en/latest/commands.html#syncdb ).
>
> So, the man page is doomed to be both incomplete and possibly incorrect. 
> Surely it makes more sense for a man page to just point to the "--help" tag 
> and official docs online?
>
> Luke
>
> On 03/03/15 15:42, Tim Graham wrote:
>  
> Is anyone interested in updating Django's man page? It's a bit 
> embarrassing that the one that ships with 1.7 includes commands that no 
> longer exist (cleanup, install (never heard of that one before), etc.). The 
> fact that it is so outdated and that we've gotten no complaints about it is 
> why I thought we could consider it for removal).
>
> Any recommendations for a program to edit/preview manpage sources that's 
> more human friendly?
>
> On Wednesday, November 26, 2014 at 8:21:31 AM UTC-5, Markus Holtermann 
> wrote: 
>>
>> On Wednesday, November 26, 2014 7:46:16 AM UTC+1, Aymeric Augustin wrote: 
>>>
>>> Le 26 nov. 2014 à 01:51, Nick Phillips  a écrit 
>>> : 
>>> > 
>>> > I'd suggest considering implementing 
>>> > something to generate a man page from whatever you wish the 
>>> "canonical" 
>>> > source of the information to be. 
>>>
>>> The canonical source of information is: 
>>> https://docs.djangoproject.com/en/dev/ref/django-admin/ 
>>>
>>> Does a rst-->man conversion tool exist? 
>>>
>>
>>  Yes, rst2man.py is part of docutils. And Sphinx even has a man builder. 
>> Inside the docs directory run "make man". The generated man page is 4MB 
>> though, and contains the _entire_ documentation, not only the 
>> django-admin.py command. But there should be some way to work around that.
>>  
>> /Markus
>>  
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-develop...@googlegroups.com .
> To post to this group, send email to django-d...@googlegroups.com 
> .
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/1ecfaac4-b31a-4675-bd62-95e76369a6e5%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> "He knows the way I take: when he has tried me, I shall come forth 
> as gold" (Job 23:10).
>
> Luke Plant || http://lukeplant.me.uk/
>
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/c4f5e150-0015-4768-a16e-2e5debaa77b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: does django-admin need a man page?

2015-06-19 Thread Luke Plant
Another argument for removing it (or trimming it down to minimum) is 
that it's actually extensible 
(https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/ 
), and some packages (at least in the past) have actually changed the 
behaviour of built in commands (e.g. 
http://south.readthedocs.org/en/latest/commands.html#syncdb ).


So, the man page is doomed to be both incomplete and possibly incorrect. 
Surely it makes more sense for a man page to just point to the "--help" 
tag and official docs online?


Luke

On 03/03/15 15:42, Tim Graham wrote:
Is anyone interested in updating Django's man page? It's a bit 
embarrassing that the one that ships with 1.7 includes commands that 
no longer exist (cleanup, install (never heard of that one before), 
etc.). The fact that it is so outdated and that we've gotten no 
complaints about it is why I thought we could consider it for removal).


Any recommendations for a program to edit/preview manpage sources 
that's more human friendly?


On Wednesday, November 26, 2014 at 8:21:31 AM UTC-5, Markus Holtermann 
wrote:


On Wednesday, November 26, 2014 7:46:16 AM UTC+1, Aymeric Augustin
wrote:

Le 26 nov. 2014 à 01:51, Nick Phillips 
a écrit :
>
> I'd suggest considering implementing
> something to generate a man page from whatever you wish the
"canonical"
> source of the information to be.

The canonical source of information is:
https://docs.djangoproject.com/en/dev/ref/django-admin/


Does a rst-->man conversion tool exist?


Yes, rst2man.py is part of docutils. And Sphinx even has a man
builder. Inside the docs directory run "make man". The generated
man page is 4MB though, and contains the _entire_ documentation,
not only the django-admin.py command. But there should be some way
to work around that.
/Markus

--
You received this message because you are subscribed to the Google 
Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-developers+unsubscr...@googlegroups.com 
.
To post to this group, send email to 
django-developers@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1ecfaac4-b31a-4675-bd62-95e76369a6e5%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
"He knows the way I take: when he has tried me, I shall come forth
as gold" (Job 23:10).

Luke Plant || http://lukeplant.me.uk/

--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/55842D5F.8010409%40cantab.net.
For more options, visit https://groups.google.com/d/optout.