#36114: when an object's __str__ consists only of whitespace, the link does not
appear in admin list page.
-------------------------------------+-------------------------------------
     Reporter:  Antoliny             |                     Type:  Bug
       Status:  new                  |                Component:
                                     |  contrib.admin
      Version:  5.1                  |                 Severity:  Normal
     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
-------------------------------------+-------------------------------------
 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)]]
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36114>
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/010701947e4bab5e-ca447cd0-8fa7-4511-8d44-f1aa8dfffd7f-000000%40eu-central-1.amazonses.com.

Reply via email to