Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all deprecation warnings #385

Merged
merged 8 commits into from Mar 30, 2016

Conversation

mx-moth
Copy link
Contributor

@mx-moth mx-moth commented Mar 24, 2016

I've fixed all deprecation warnings from all versions of Django supported by taggit, while maintaining backwards compatibility with all currently supported versions, and with all tests passing.

This involved adding some helpers for the recently renamed field.rel.to/field.remote_field.model, and changing the use of add_lazy_relation to lazy_related_operation on Django 1.9.

SQL names are quoted using the correct function now, fixing #380 and #383.

on_delete=models.CASCADE has been added to all ForeignKeys where it was missing, including in tests and migrations. This is backwards compatible with current code and projects, as on_delete=models.CASCADE was the assumed default previously.

Warnings due to different versions of unittest bundled through different version of Django have been sorted out, as has a warning from Django for Python 3.3, 3.4.

Finally, DeprecationWarnings are now show in test output. As there are no more deprecation warnings, the test output is still useable as it is before, without being polluted with lots of DeprecationWarning noise.

@@ -56,7 +57,22 @@ def _get_form_str(self, form_str):
return form_str

def assert_form_renders(self, form, html):
self.assertHTMLEqual(str(form), self._get_form_str(html))
# Django causes a DeprecationWarning on Python 3.3, 3.4
if (3, 3) >= sys.version_info > (3, 5):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this always evaluate to False?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Which means if the DeprecationWarnings are not appearing, that particular issue must have gone away... I'll look in to it.

@mx-moth
Copy link
Contributor Author

mx-moth commented Mar 24, 2016

I fixed the backwards conditional that you spotted, properly silencing the DeprecationWarning from Django in those versions of Python.

@frewsxcv
Copy link
Collaborator

Sorry for the delay! Thanks a bunch, your contributions are greatly appreciated ✨

@frewsxcv frewsxcv merged commit 58c675d into jazzband:develop Mar 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants