Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Release Notes

(From: https://docs.djangoproject.com/en/1.11/releases/1.11/)

...

from tzlocal import get_localzone

TIME_ZONE = get_localzone().zone

This works similar to settings.TIME_ZONE = None except that it also sets os.environ['TZ']Let us know if there’s a use case where you find you can’t adapt your code to set a TIME_ZONE.

...

from django.db import models

class MyModel(models.Model):
    ...

    @models.permalink
    def url(self):
        return ('guitarist_detail', [self.slug])

becomes:

from django.db import models
from django.urls import reverse

class MyModel(models.Model):
    ...

    def url(self):
        return reverse('guitarist_detail', args=[self.slug])


Miscellaneous

  • contrib.auth’s login() and logout() function-based views are deprecated
    Jira Legacy
    showSummaryfalse
    serverJIRA (openedx.atlassian.net)
    serverId13fd1930-5608-3aac-a5dd-21b934d3a4b4
    keyPLAT-1446
    in favor of new class-based views LoginView andLogoutView.
  • The unused extra_context parameter of contrib.auth.views.logout_then_login() is deprecated.
  • contrib.auth’s password_change()password_change_done()password_reset()password_reset_done()password_reset_confirm(), and password_reset_complete() function-based views are deprecated
    Jira Legacy
    showSummaryfalse
    serverJIRA (openedx.atlassian.net)
    serverId13fd1930-5608-3aac-a5dd-21b934d3a4b4
    keyPLAT-1448
    in favor of new class-based views PasswordChangeViewPasswordChangeDoneViewPasswordResetViewPasswordResetDoneView,PasswordResetConfirmView, and PasswordResetCompleteView.
  • django.test.runner.setup_databases() is moved
    Jira Legacy
    showSummaryfalse
    serverJIRA (openedx.atlassian.net)
    serverId13fd1930-5608-3aac-a5dd-21b934d3a4b4
    keyPLAT-1449
    to django.test.utils.setup_databases(). The old location is deprecated.
  • django.utils.translation.string_concat() is deprecated in favor of django.utils.text.format_lazy()string_concat(*strings) can be replaced by format_lazy('{}' * len(strings), *strings).
  • For the PyLibMCCache cache backend, passing pylibmc behavior settings as top-level attributes of OPTIONS is deprecated. Set them under a behaviors key within OPTIONS instead.
  • The host parameter of django.utils.http.is_safe_url() is deprecated in favor of the new allowed_hosts parameter.
  • Silencing exceptions raised while rendering the {% include %} template tag is deprecated as the behavior is often more confusing than helpful. In Django 2.1, the exception will be raised.
  • DatabaseIntrospection.get_indexes() is deprecated in favor of DatabaseIntrospection.get_constraints().
  • authenticate() now passes a request argument to the authenticate() method of authentication backends. Support for methods that don’t accept request as the first positional argument will be removed in Django 2.1.
  • The USE_ETAGS setting is deprecated in favor of ConditionalGetMiddleware which now adds the ETag header to responses regardless of the setting. CommonMiddleware and django.utils.cache.patch_response_headers() will no longer set ETags when the deprecation ends.
  • Model._meta.has_auto_field is deprecated in favor of checking if Model._meta.auto_field is not None.
  • Using regular expression groups with iLmsu# in url() is deprecated. The only group that’s useful is (?i) for case-insensitive URLs, however, case-insensitive URLs aren’t a good practice because they create multiple entries for search engines, for example. An alternative solution could be to create a handler404 that looks for uppercase characters in the URL and redirects to a lowercase equivalent.
  • The renderer argument is added to the Widget.render() method. Methods that don’t accept that argument will work through a deprecation period.