Loading django/db/backends/mysql/base.py +2 −1 Original line number Diff line number Diff line Loading @@ -383,8 +383,9 @@ class DatabaseWrapper(BaseDatabaseWrapper): kwargs = { 'conv': django_conversions, 'charset': 'utf8', 'use_unicode': True, } if not six.PY3: kwargs['use_unicode'] = True settings_dict = self.settings_dict if settings_dict['USER']: kwargs['user'] = settings_dict['USER'] Loading django/db/backends/mysql/validation.py +2 −1 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ class DatabaseValidation(BaseDatabaseValidation): from django.db import models varchar_fields = (models.CharField, models.CommaSeparatedIntegerField, models.SlugField) if isinstance(f, varchar_fields) and f.max_length > 255 and f.unique: if (isinstance(f, varchar_fields) and f.unique and (f.max_length is None or int(f.max_length) > 255)): msg = '"%(name)s": %(cls)s cannot have a "max_length" greater than 255 when using "unique=True".' errors.add(opts, msg % {'name': f.name, 'cls': f.__class__.__name__}) docs/ref/databases.txt +11 −2 Original line number Diff line number Diff line Loading @@ -209,6 +209,15 @@ required for full MySQL support in Django. .. _MySQLdb: http://sourceforge.net/projects/mysql-python Python 3 -------- At the time of writing, the latest release of MySQLdb (1.2.4) doesn't support Python 3. In order to use MySQL under Python 3, you'll have to install an unofficial fork, such as `MySQL-for-Python-3`_. .. _MySQL-for-Python-3: https://github.com/clelland/MySQL-for-Python-3 Creating your database ---------------------- Loading Loading @@ -318,8 +327,8 @@ Here's a sample configuration which uses a MySQL option file:: default-character-set = utf8 Several other MySQLdb connection options may be useful, such as ``ssl``, ``use_unicode``, ``init_command``, and ``sql_mode``. Consult the `MySQLdb documentation`_ for more details. ``init_command``, and ``sql_mode``. Consult the `MySQLdb documentation`_ for more details. .. _MySQL option file: http://dev.mysql.com/doc/refman/5.0/en/option-files.html .. _MySQLdb documentation: http://mysql-python.sourceforge.net/ Loading Loading
django/db/backends/mysql/base.py +2 −1 Original line number Diff line number Diff line Loading @@ -383,8 +383,9 @@ class DatabaseWrapper(BaseDatabaseWrapper): kwargs = { 'conv': django_conversions, 'charset': 'utf8', 'use_unicode': True, } if not six.PY3: kwargs['use_unicode'] = True settings_dict = self.settings_dict if settings_dict['USER']: kwargs['user'] = settings_dict['USER'] Loading
django/db/backends/mysql/validation.py +2 −1 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ class DatabaseValidation(BaseDatabaseValidation): from django.db import models varchar_fields = (models.CharField, models.CommaSeparatedIntegerField, models.SlugField) if isinstance(f, varchar_fields) and f.max_length > 255 and f.unique: if (isinstance(f, varchar_fields) and f.unique and (f.max_length is None or int(f.max_length) > 255)): msg = '"%(name)s": %(cls)s cannot have a "max_length" greater than 255 when using "unique=True".' errors.add(opts, msg % {'name': f.name, 'cls': f.__class__.__name__})
docs/ref/databases.txt +11 −2 Original line number Diff line number Diff line Loading @@ -209,6 +209,15 @@ required for full MySQL support in Django. .. _MySQLdb: http://sourceforge.net/projects/mysql-python Python 3 -------- At the time of writing, the latest release of MySQLdb (1.2.4) doesn't support Python 3. In order to use MySQL under Python 3, you'll have to install an unofficial fork, such as `MySQL-for-Python-3`_. .. _MySQL-for-Python-3: https://github.com/clelland/MySQL-for-Python-3 Creating your database ---------------------- Loading Loading @@ -318,8 +327,8 @@ Here's a sample configuration which uses a MySQL option file:: default-character-set = utf8 Several other MySQLdb connection options may be useful, such as ``ssl``, ``use_unicode``, ``init_command``, and ``sql_mode``. Consult the `MySQLdb documentation`_ for more details. ``init_command``, and ``sql_mode``. Consult the `MySQLdb documentation`_ for more details. .. _MySQL option file: http://dev.mysql.com/doc/refman/5.0/en/option-files.html .. _MySQLdb documentation: http://mysql-python.sourceforge.net/ Loading