Re: [Django] #25790: Admin magic change list UI ordering is too helpful?

2015-11-20 Thread Django
#25790: Admin magic change list UI ordering is too helpful?
-+-
 Reporter:  ramiro   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  contrib.admin|  Version:  1.8
 Severity:  Normal   |   Resolution:
 Keywords:  sorting ordering | Triage Stage:
  change list changelist admin   |  Unreviewed
Has patch:  1|  Needs documentation:  1
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by ramiro):

 * needs_docs:  0 => 1
 * has_patch:  0 => 1
 * needs_tests:  0 => 1


Comment:

 There is some work in this branch:
 https://github.com/django/django/compare/master...ramiro:ticket_25790?expand=1

 I'm thinking now it's wrong or at least incomplete.

 I suspect this is overloading the `ModelAdmin.ordering` option (which is
 for specifying the change list default/initial ordering) with an
 additional function.

 A possible solution, provided the feature proposed by this ticket is
 accepted, is to have another option e.g. `orderable_by` which when not
 provided makes things behave like they do now and when specified (a list
 of fields) is ORed with `ordering` to get the final list of columns which
 will actually be allowed to sort by.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6a4ba8675d1197b247614b4aadec5d80%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25790: Admin magic change list UI ordering is too helpful?

2015-11-20 Thread Django
#25790: Admin magic change list UI ordering is too helpful?
-+-
 Reporter:  ramiro   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  contrib.admin|  Version:  1.8
 Severity:  Normal   |   Resolution:
 Keywords:  sorting ordering | Triage Stage:
  change list changelist admin   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by ramiro:

Old description:

> Consider this model:
>
> {{{
> # models.py
> from __future__ import unicode_literals
>
> from django.db import models
>

> class CreditCard(models.Model):
> issued_to = models.CharField(max_length=40)
> valid_to = models.DateField()
> last_four_digits = models.CharField(max_length=4)
> }}}
>
> And this admin.py for the app:
> {{{
> from django.contrib import admin
>
> from app.models import CreditCard
>

> class CCAdmin(admin.ModelAdmin):
> list_display = [
> 'issued_to',
> 'valid_to',
> 'last_four_digits',
> ]
> ordering = ['valid_to']
>
> def last4digits(self, obj):
> """So we don't get bogus ordering by this field in the change
> list view."""
> return obj.last_four_digits
> last4digits.short_description = '4 last digits'
>

> admin.site.register(CreditCard, CCAdmin)
> }}}
>
> The user has specified explicitly he/she wants the change list view grid
> to be sortable by default by the credt card expiration date by using the
> `ModelAdmin.ordering`option.
>
> Now, the interactive sorting changelist functionality that allows one to
> sort by a column by clicking on its header automagically allows one to
> also sort by other columns chosen by a documented logic (i.e. not if
> callable columns, etc.).
>
> In the example, it allows users to also sort by the name of the credit
> card owner which, even if not asked for, seems useful.
>
> Where it doesn't make so much sense is, for the example, in the case of
> the 'last four digits' column. IMHO there should be a way to express
> which columns one wants this functionality  without having to resort to
> things like
>
> {{{
> class CCAdmin(admin.ModelAdmin):
> list_display = [
> 'issued_to',
> 'valid_to',
> 'last4digits',
> ]
> #...
>
> def last4digits(self, obj):
> """So we don't get bogus ordering by this field in the change
> list view."""
> return obj.last_four_digits
> last4digits.short_description = '4 last digits'
> }}}

New description:

 Consider this model:

 {{{
 # models.py
 from __future__ import unicode_literals

 from django.db import models


 class CreditCard(models.Model):
 issued_to = models.CharField(max_length=40)
 valid_to = models.DateField()
 last_four_digits = models.CharField(max_length=4)
 }}}

 And this admin.py for the app:
 {{{
 from django.contrib import admin

 from app.models import CreditCard


 class CCAdmin(admin.ModelAdmin):
 list_display = [
 'issued_to',
 'valid_to',
 'last_four_digits',
 ]
 ordering = ['valid_to']


 admin.site.register(CreditCard, CCAdmin)
 }}}

 The user has specified explicitly he/she wants the change list view grid
 to be sortable by default by the credt card expiration date by using the
 `ModelAdmin.ordering`option.

 Now, the interactive sorting changelist functionality that allows one to
 sort by a column by clicking on its header automagically allows one to
 also sort by other columns chosen by a documented logic (i.e. not if
 callable columns, etc.).

 In the example, it allows users to also sort by the name of the credit
 card owner which, even if not asked for, seems useful.

 Where it doesn't make so much sense is, for the example, in the case of
 the 'last four digits' column. IMHO there should be a way to express which
 columns one wants this functionality  without having to resort to things
 like

 {{{
 class CCAdmin(admin.ModelAdmin):
 list_display = [
 'issued_to',
 'valid_to',
 'last4digits',
 ]
 #...

 def last4digits(self, obj):
 """So we don't get bogus ordering by this field in the change list
 view."""
 return obj.last_four_digits
 last4digits.short_description = '4 last digits'
 }}}

--

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving 

[Django] #25790: Admin magic change list UI ordering is too helpful?

2015-11-20 Thread Django
#25790: Admin magic change list UI ordering is too helpful?
-+-
   Reporter:  ramiro |  Owner:  nobody
   Type:  New| Status:  new
  feature|
  Component: |Version:  1.8
  contrib.admin  |   Keywords:  sorting ordering
   Severity:  Normal |  change list changelist admin
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 Consider this model:

 {{{
 # models.py
 from __future__ import unicode_literals

 from django.db import models


 class CreditCard(models.Model):
 issued_to = models.CharField(max_length=40)
 valid_to = models.DateField()
 last_four_digits = models.CharField(max_length=4)
 }}}

 And this admin.py for the app:
 {{{
 from django.contrib import admin

 from app.models import CreditCard


 class CCAdmin(admin.ModelAdmin):
 list_display = [
 'issued_to',
 'valid_to',
 'last_four_digits',
 ]
 ordering = ['valid_to']

 def last4digits(self, obj):
 """So we don't get bogus ordering by this field in the change list
 view."""
 return obj.last_four_digits
 last4digits.short_description = '4 last digits'


 admin.site.register(CreditCard, CCAdmin)
 }}}

 The user has specified explicitly he/she wants the change list view grid
 to be sortable by default by the credt card expiration date by using the
 `ModelAdmin.ordering`option.

 Now, the interactive sorting changelist functionality that allows one to
 sort by a column by clicking on its header automagically allows one to
 also sort by other columns chosen by a documented logic (i.e. not if
 callable columns, etc.).

 In the example, it allows users to also sort by the name of the credit
 card owner which, even if not asked for, seems useful.

 Where it doesn't make so much sense is, for the example, in the case of
 the 'last four digits' column. IMHO there should be a way to express which
 columns one wants this functionality  without having to resort to things
 like

 {{{
 class CCAdmin(admin.ModelAdmin):
 list_display = [
 'issued_to',
 'valid_to',
 'last4digits',
 ]
 #...

 def last4digits(self, obj):
 """So we don't get bogus ordering by this field in the change list
 view."""
 return obj.last_four_digits
 last4digits.short_description = '4 last digits'
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.dfb640f25dc6a42bb8c968ae5b0cdfc7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.