Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2024-03-18 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
---+
 Reporter:  Claude Paroz   |Owner:  (none)
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  dev
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+
Changes (by Ülgen Sarıkavak):

 * cc: Ülgen Sarıkavak (added)

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e50577c82-3414d429-7392-4563-912f-068a1d039327-00%40eu-central-1.amazonses.com.


Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2022-02-18 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
---+
 Reporter:  Claude Paroz   |Owner:  (none)
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  dev
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+
Changes (by Mariusz Felisiak):

 * owner:  Renato Oliveira => (none)
 * status:  assigned => new


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.490d0e05c410fd945281ab720a9f1116%40djangoproject.com.


Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2017-01-25 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
---+---
 Reporter:  Claude Paroz   |Owner:  Renato Oliveira
 Type:  Bug|   Status:  assigned
Component:  contrib.admin  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+---

Comment (by Renato Oliveira):

 I'm trying to write something here but nothing seems to fit. Maybe because
 I'm not fluent on English
 {{{
 * The ``__str__()`` method is just as valid in ``list_display`` as any
   other model method, so it's perfectly OK to do this::

   list_display = ('__str__', 'some_other_field')

 * Usually, elements of ``list_display`` that aren't actual database
   fields can't be used in sorting (because Django does all the sorting
   at the database level).

   However, if an element of ``list_display`` represents a certain
   database field, you can indicate this fact by setting the
   ``admin_order_field`` attribute of the item.
   This rule doesn't apply to ``__str__`` method.
 }}}

 It's missing why it's not applicable, but It's not clear to me how to say
 that

--
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/065.1e7bc266a1120294b707a06e19481edc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2017-01-25 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
---+---
 Reporter:  Claude Paroz   |Owner:  Renato Oliveira
 Type:  Bug|   Status:  assigned
Component:  contrib.admin  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+---

Comment (by Tim Graham):

 Is it worth adding a special case in `get_ordering_field()` to get
 `__str__()` from the model instead of the `ModelAdmin` (which probably
 wouldn't have a useful `__str__()`? I think probably not. We might just
 document that `admin_order_field` isn't usable with `Model.__str__()` and
 move on to more important issues.

--
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/065.8ac5c8f450286e2f5e28646aa610eaa7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2017-01-24 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
-+-
 Reporter:  Claude Paroz |Owner:  Renato
 |  dos Santos Oliveira
 Type:  Bug  |   Status:  assigned
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Renato dos Santos Oliveira):

 Hey, I think I found the issue here.

 Changing as you said `attr = str` to `attr = model.__str__` it makes the
 column clickable and adds the field position to the `o` querystring. The
 problem is that when it gets to the admin view (here:
 
https://github.com/django/django/blob/master/django/contrib/admin/views/main.py#L227-L233)
 it verifies first if the attribute is an instance of the model_admin class
 and it turns out that ModelAdmin has a __str__ field, not carrying the
 `model.__str__.admin_order_field` attribute to the ordering query.

 this is the `attr` representation  with the `model_admin` elif ``

 for testing purposes I removed the model_admin and got this

 `` and it had the
 `admin_order_field` attribute, making ordering work properly.

 I still don't know how to solve this and would be awesome to have your
 help on this.

 Thanks

--
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/065.0b3ba28cea1661ab2a5febfd9b0132ce%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2017-01-24 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
-+-
 Reporter:  Claude Paroz |Owner:  Renato
 |  dos Santos Oliveira
 Type:  Bug  |   Status:  assigned
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Renato dos Santos Oliveira):

 * status:  new => assigned
 * owner:  (none) => Renato dos Santos Oliveira


--
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/065.93eade5ced626a9714f342c9b6923130%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2017-01-24 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
---+
 Reporter:  Claude Paroz   |Owner:  (none)
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+

Comment (by Tim Graham):

 For example, adding to the `Question` model in the tutorial:

 `__str__.admin_order_field = 'question_text'`

 and to `QuestionAdmin`:

 `list_display = ('__str__', ...)`

 should reproduce this. You'll see that the `__str__` column isn't
 clickable for sorting like it should be. In the `lable_for_field`
 function, I tried changing `attr = str` to `attr = model.__str__` -- this
 makes the column clickable but sorting still doesn't seem to work
 correctly.

--
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/065.dcbc23924508aca3171c981e4a6e00cf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2017-01-24 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
---+
 Reporter:  Claude Paroz   |Owner:  (none)
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+
Changes (by Renato dos Santos Oliveira):

 * cc: renato+github@… (added)


--
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/065.be2eec8b83b5d38cc20fe57b76d1e733%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2017-01-21 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
---+
 Reporter:  Claude Paroz   |Owner:  (none)
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+
Changes (by Renato dos Santos Oliveira):

 * status:  assigned => new
 * cc: renato+github@… (removed)
 * owner:  Renato dos Santos Oliveira => (none)


--
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/065.3a7efa8fbc842398a077b95cf103b1ee%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27752: Fix and test admin_order_field set for the __str__ of a model

2017-01-21 Thread Django
#27752: Fix and test admin_order_field set for the __str__ of a model
-+-
 Reporter:  Claude Paroz |Owner:  Renato
 |  dos Santos Oliveira
 Type:  Bug  |   Status:  assigned
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Renato dos Santos Oliveira):

 * cc: renato+github@… (added)
 * owner:  nobody => Renato dos Santos Oliveira
 * status:  new => assigned


--
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/065.55e229d80558ecee97acd7afd0774ecb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.