Skip to content

Fix imports with Django 2.0 #5485

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

Closed
wants to merge 1 commit into from
Closed

Fix imports with Django 2.0 #5485

wants to merge 1 commit into from

Conversation

devbis
Copy link

@devbis devbis commented Oct 7, 2017

Django 2.0 renamed classes for resolving urls

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

changes seems OK to me but should look for others too

@ghost
Copy link

ghost commented Oct 8, 2017

Its raise another error:

File "/home/r/w/new/.env/lib/python3.6/site-packages/rest_framework/urlpatterns.py", line 25, in apply_suffix_patterns
regex = urlpattern.regex.pattern.rstrip('$').rstrip('/') + suffix_pattern
AttributeError: 'URLPattern' object has no attribute 'regex'

$ pip list
Django (2.0a1)
djangorestframework (3.7.0)
...

@anx-ckreuzberger
Copy link
Contributor

This seems to fix issue #5456

@thomwiggers
Copy link

I've already tried and tested this fix, but since they not only renamed classes but changed the API this fix is far from complete.

@auvipy
Copy link
Member

auvipy commented Oct 10, 2017

Invalid template library specified. ImportError raised when trying to load 'rest_framework.templatetags.rest_framework': No module named 'django.core.urlresolvers'

error while working with django==2.0a1 and drf3.7

@carltongibson carltongibson added this to the 3.7.1 Release milestone Oct 11, 2017
@carltongibson
Copy link
Collaborator

Closed by #5500

@devbis devbis deleted the patch-1 branch October 16, 2017 12:12
rht added a commit to rht/zulip that referenced this pull request Jan 5, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
rht added a commit to rht/zulip that referenced this pull request Jan 5, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
rht added a commit to rht/zulip that referenced this pull request Jan 5, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
rht added a commit to rht/zulip that referenced this pull request Jan 5, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
rht added a commit to rht/zulip that referenced this pull request Jan 5, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
rht added a commit to rht/zulip that referenced this pull request Jan 5, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
5. `django.core.management.call_command`'s argument app_labels is
   renamed to app_label.
rht added a commit to rht/zulip that referenced this pull request Jan 5, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
5. `django.core.management.call_command`'s argument app_labels is
   renamed to app_label.
rht added a commit to rht/zulip that referenced this pull request Jan 5, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
5. `django.core.urlresolvers.LocaleRegexURLResolver` is renamed to
   `django.urls.URLResolver` with a locale argument. See
   https://github.com/django/django/pull/7482/files#diff-ebbd729cb6cf937dea8ce3de4e3332f2R17
6. `django.core.management.call_command`'s argument app_labels is
   renamed to app_label.
rht added a commit to rht/zulip that referenced this pull request Jan 8, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
5. `django.core.urlresolvers.LocaleRegexURLResolver` is renamed to
   `django.urls.URLResolver` with a locale argument. See
   https://github.com/django/django/pull/7482/files#diff-ebbd729cb6cf937dea8ce3de4e3332f2R17
6. `django.core.management.call_command`'s argument app_labels is
   renamed to app_label.
rht added a commit to rht/zulip that referenced this pull request Jan 8, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
5. `django.core.urlresolvers.LocaleRegexURLResolver` is renamed to
   `django.urls.URLResolver` with a locale argument. See
   https://github.com/django/django/pull/7482/files#diff-ebbd729cb6cf937dea8ce3de4e3332f2R17
6. `django.core.management.call_command`'s argument app_labels is
   renamed to app_label.
rht added a commit to rht/zulip that referenced this pull request Jan 31, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
5. `django.core.urlresolvers.LocaleRegexURLResolver` is renamed to
   `django.urls.URLResolver` with a locale argument. See
   https://github.com/django/django/pull/7482/files#diff-ebbd729cb6cf937dea8ce3de4e3332f2R17
6. `django.core.management.call_command`'s argument app_labels is
   renamed to app_label.
rht added a commit to rht/zulip that referenced this pull request Feb 1, 2018
List of API changes:
1. `models.Foreignkey`: `on_delete` argument is no longer optional.
2. Functions in `django.core.urlresolvers` are moved to `django.urls`
   and `django.urls.resolvers`.
3. `django.core.urlresolvers.LocaleRegexProvider` is renamed to
   `django.urls.resolvers.RegexPattern`. See
   arteria/django-compat#61.
4. `django.core.urlresolvers.RegexURLPattern` is renamed to
   `django.urls.resolvers.URLPattern`. See
   encode/django-rest-framework#5485.
5. `django.core.urlresolvers.LocaleRegexURLResolver` is renamed to
   `django.urls.URLResolver` with a locale argument. See
   https://github.com/django/django/pull/7482/files#diff-ebbd729cb6cf937dea8ce3de4e3332f2R17
6. `django.core.management.call_command`'s argument app_labels is
   renamed to app_label.
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.

5 participants