#36114: when an object's __str__ consists only of whitespace, the link does not
appear in admin list page.
-------------------------------------+-------------------------------------
     Reporter:  Antoliny             |                    Owner:  Antoliny
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  5.1
     Severity:  Normal               |               Resolution:
     Keywords:  list_display_links,  |             Triage Stage:
  list_display                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Antoliny:

Old description:

> In the admin list page, when the value of `list_display` is set to
> '__str__' (default option), if the model's `__str__` is composed entirely
> of blank values, the link will not appear.
> {{{
> class Post(models.Model):
>     title = models.CharField(max_length=128)
>     content = models.TextField()
>     like = models.IntegerField(default=0)
>
>     def __str__(self):
>         return "       "
> }}}
> [[Image(blank.png)]]
> In a typical situation it would be fine, but when `__str__` is set in
> `list_display_links`, <a> tag innerHTML becomes empty, so resulting in
> the loss of the link functionality to navigate to the object.
> {{{
> class PostAdmin(admin.ModelAdmin):
>     list_display_links = ["__str__"]
>     list_display = ["__str__", "title"]
> }}}
> [[Image(str_blank.png)]]

New description:

 In the admin list page, when the value of `list_display` is set to
 '__str__' (default option), if the model's `__str__` is composed entirely
 of blank values, the link will not appear.
 {{{
 class Post(models.Model):
     title = models.CharField(max_length=128)
     content = models.TextField()
     like = models.IntegerField(default=0)

     def __str__(self):
         return "       "
 }}}
 [[Image(balnk.png)]]
 In a typical situation it would be fine, but when `__str__` is set in
 `list_display_links`, <a> tag innerHTML becomes empty, so resulting in the
 loss of the link functionality to navigate to the object.
 {{{
 class PostAdmin(admin.ModelAdmin):
     list_display_links = ["__str__"]
     list_display = ["__str__", "title"]
 }}}
 [[Image(str_blank.png)]]

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36114#comment:2>
Django <https://code.djangoproject.com/>
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701947e4c676f-9491d08a-e608-4fb9-b445-69185295a512-000000%40eu-central-1.amazonses.com.

Reply via email to