pytest-dev / pytest-django

A Django plugin for pytest.
https://pytest-django.readthedocs.io/
Other
1.37k stars 344 forks source link

Fix issue with {% if model.related %} where related is None. Fixes #1059 #1070

Closed voidus closed 1 year ago

voidus commented 1 year ago

I couldn't get the tests to run on my machine with either the makefile, pytest directly or tox, so I'm trusting the github actions.

voidus commented 1 year ago

Ok got it this works PYTHONPATH=$PWD DJANGO_SETTINGS_MODULE=pytest_django_test.settings_sqlite_file ./build/venv/bin/python -m pytest

voidus commented 1 year ago

Ok this is complete nonsense because RelatedManagers are truthy, and thus bool(model.related) is always True. I was looking for model.related.exists().

Running the tests is still janky though. But sorry for the noise.