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

Deprecation warnings on Django 1.10 #89

Closed
mdentremont opened this issue Sep 9, 2016 · 3 comments
Closed

Deprecation warnings on Django 1.10 #89

mdentremont opened this issue Sep 9, 2016 · 3 comments

Comments

@mdentremont
Copy link

After updating to Django 1.10, I'm seeing a deprecation warnings which originate from django-sortedm2m:

...
/Users/<username>/.virtualenvs/<proj>/lib/python3.5/site-packages/sortedm2m/fields.py:334: RemovedInDjango20Warning: Usage of ForeignObjectRel.to attribute has been deprecated. Use the model attribute instead.
  to_model = self.rel.to
/Users/<username>/.virtualenvs/<proj>/lib/python3.5/site-packages/sortedm2m/fields.py:354: RemovedInDjango20Warning: Usage of field.rel has been deprecated. Use field.remote_field instead.
  if self.rel.to == RECURSIVE_RELATIONSHIP_CONSTANT or to_object_name == klass._meta.object_name:
/Users/<username>/.virtualenvs/<proj>/lib/python3.5/site-packages/sortedm2m/fields.py:354: RemovedInDjango20Warning: Usage of ForeignObjectRel.to attribute has been deprecated. Use the model attribute instead.
  if self.rel.to == RECURSIVE_RELATIONSHIP_CONSTANT or to_object_name == klass._meta.object_name:
/Users/<username>/.virtualenvs/<proj>/lib/python3.5/site-packages/sortedm2m/compat.py:37: RemovedInDjango20Warning: Usage of field.rel has been deprecated. Use field.remote_field instead.
  db_constraint=field.rel.db_constraint)
/Users/<username>/.virtualenvs/<proj>/lib/python3.5/site-packages/sortedm2m/fields.py:360: RemovedInDjango20Warning: on_delete will be a required arg for ForeignKey in Django 2.0. Set it to models.CASCADE on models and in existing migrations if you want to maintain the current default behavior. See https://docs.djangoproject.com/en/1.10/ref/models/fields/#django.db.models.ForeignKey.on_delete
  **get_foreignkey_field_kwargs(self))
...

Most of these look fairly minor, but it just might be slightly annoying to make the changes work across older versions of Django.

@gregmuellegger
Copy link
Collaborator

To make things compatible with older Django versions, I usually place a helper function in compat.py. Would you be willing to provide a PR to fix the deprecation warnings?

@mdentremont
Copy link
Author

@gregmuellegger Unfortunately I've moved on to a different company which doesn't use Django - so I wouldn't have any way to test this against an application anymore :(

@jharrell
Copy link

jharrell commented Apr 8, 2017

#104 seems to resolve these deprecation warnings

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

No branches or pull requests

3 participants