Unnecessary check for thruthiness in view_on_site generation?

From another discussion I found the function used to generate the view_on_site url in the admin.

Thing is, why self.view_on_site is checked for truthiness in the elif statement?
If it were False it should be captured in the first statement of the function. (L294)

The function was added 7 years ago in it’s entirety so I don’t think this check is there for backwards compatibility.

This looks like it might just be an oversight by the original patch author - if you can remove it and the tests pass, then I think it’s sensible to remove it now.

I’ll try to make my first (tiny) contribution to Django source code.

Thanks Andrew!

1 Like

Hello Andrew.

Considering the tiny change in the code, should I make the PR directly from Github? As I understand, tests should ran on djangoCI.

Either case, is django-docker-box still relevant?

As long as your contribution ends up as a pull request, how you get there isn’t a massive concern - just make sure it follows all the PR rules and things should be good!

Not sure about django-docker-box - I never used it personally, since I have a waaaay more complex local setup :slight_smile: