Ordered lists are mistakenly styled with `list-style-type: square` when
nested inside an unordered list. Thus, if an ordered list is nested inside
an unordered list in a docstring, it is rendered incorrectly by admindocs.
This is caused by the CSS rule in
[https://github.com/django/django/blob/24e540fbd71bd2b0843e751bde61ad0052a811b3/django/contrib/admin/static/admin/css/base.css#L97
base.css, line 97]:
{{{
ul li { list-style-type: square; }
}}}
== Example
{{{
# models.py
class Store(models.Model):
"""
This model represents a store that has products available.
- Unordered list item 1
1. Ordered sub-list item 1
2. Ordered sub-list item 2
"""
pass
}}}
Expected behavior when rendered in browser:
- Unordered list item 1
1. Ordered sub-list item 1
2. Ordered sub-list item 2
Actual behavior when rendered in browser:
- Unordered list item 1
- Ordered sub-list item 1
- Ordered sub-list item 2
== Solution
The CSS should apply only to list items directly inside an unordered list
like this:
{{{
ul > li { list-style-type: square; }
}}}
See pull request: https://github.com/django/django/pull/12307
--
Ticket URL: <https://code.djangoproject.com/ticket/31160>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Owen Heisler
* status: new => assigned
* stage: Unreviewed => Accepted
Comment:
[https://github.com/django/django/pull/12307 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31160#comment:1>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/31160#comment:2>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"77d335e5abec889b15323975187a8d5b10bfcb0f" 77d335e]:
{{{
#!CommitTicketReference repository=""
revision="77d335e5abec889b15323975187a8d5b10bfcb0f"
Fixed #31160 -- Fixed admin CSS for ordered lists' descendants in
unordered list.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31160#comment:3>