diff options
| author | Claude Paroz <claude@2xlibre.net> | 2016-11-19 18:19:41 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-01-18 09:55:19 +0100 |
| commit | d7b9aaa366dd54ecc3142c588162e3adc7c2f7ac (patch) | |
| tree | c7faf11a6f6c14981a08a621c36e6f736b21dd8b /docs/topics | |
| parent | 397b3705c5f762b359cdb494f9447c8a60685adf (diff) | |
Refs #23919 -- Removed encoding preambles and future imports
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/i18n/formatting.txt | 2 | ||||
| -rw-r--r-- | docs/topics/migrations.txt | 26 | ||||
| -rw-r--r-- | docs/topics/templates.txt | 2 |
3 files changed, 0 insertions, 30 deletions
diff --git a/docs/topics/i18n/formatting.txt b/docs/topics/i18n/formatting.txt index 248d6b0d23..4a0ce6d3e8 100644 --- a/docs/topics/i18n/formatting.txt +++ b/docs/topics/i18n/formatting.txt @@ -177,8 +177,6 @@ To customize the English formats, a structure like this would be needed:: where :file:`formats.py` contains custom format definitions. For example:: - from __future__ import unicode_literals - THOUSAND_SEPARATOR = '\xa0' to use a non-breaking space (Unicode ``00A0``) as a thousand separator, diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt index e8675fe545..5475e7b385 100644 --- a/docs/topics/migrations.txt +++ b/docs/topics/migrations.txt @@ -454,10 +454,7 @@ the file in the right place, suggest a name, and add dependencies for you):: Then, open up the file; it should look something like this:: - # -*- coding: utf-8 -*- # Generated by Django A.B on YYYY-MM-DD HH:MM - from __future__ import unicode_literals - from django.db import migrations, models class Migration(migrations.Migration): @@ -485,9 +482,6 @@ combined values of ``first_name`` and ``last_name`` (we've come to our senses and realized that not everyone has first and last names). All we need to do is use the historical model and iterate over the rows:: - # -*- coding: utf-8 -*- - from __future__ import unicode_literals - from django.db import migrations, models def combine_names(apps, schema_editor): @@ -757,26 +751,6 @@ The decorator adds logic to capture and preserve the arguments on their way into your constructor, and then returns those arguments exactly when deconstruct() is called. -Supporting Python 2 and 3 -========================= - -In order to generate migrations that support both Python 2 and 3, all string -literals used in your models and fields (e.g. ``verbose_name``, -``related_name``, etc.), must be consistently either bytestrings or text -(unicode) strings in both Python 2 and 3 (rather than bytes in Python 2 and -text in Python 3, the default situation for unmarked string literals.) -Otherwise running :djadmin:`makemigrations` under Python 3 will generate -spurious new migrations to convert all these string attributes to text. - -The easiest way to achieve this is to follow the advice in Django's -:doc:`Python 3 porting guide </topics/python3>` and make sure that all your -modules begin with ``from __future__ import unicode_literals``, so that all -unmarked string literals are always unicode, regardless of Python version. When -you add this to an app with existing migrations generated on Python 2, your -next run of :djadmin:`makemigrations` on Python 3 will likely generate many -changes as it converts all the bytestring attributes to text strings; this is -normal and should only happen once. - Supporting multiple Django versions =================================== diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt index a819acf3f0..23d74cbaa3 100644 --- a/docs/topics/templates.txt +++ b/docs/topics/templates.txt @@ -422,8 +422,6 @@ environment. For example, you can create ``myproject/jinja2.py`` with this content:: - from __future__ import absolute_import # Python 2 only - from django.contrib.staticfiles.storage import staticfiles_storage from django.urls import reverse |
