There's something I discovered about the Rails framework which I really like, the ability to test the output of templates really easily with css selector, for example test how many "li" elements are in a page, if an element with a certain ID is present, ecc.
AssertContains feels really limited compared to these instruments, check them out: http://guides.rubyonrails.org/testing.html#testing-views
How to achieve something similar with django? Is there a python library that implements CSS selectors?
You can use Selenium to find elements using CSS selectors, xpath, etc. The driver is specific to a browser, like the Firefox driver, Chrome driver, etc, but it's about the closest you'll get in Django.
See: https://docs.djangoproject.com/en/4.0/topics/testing/tools/#liveservertestcase
and: http://selenium-python.readthedocs.org/en/latest/locating-elements.html for the selectors available in Selenium.