﻿id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 20207 `ManyToManyField` with an unicode name fails to create an intermediary model. charettes charettes "I encountered the following error when porting an app codebase to support both python 2 and 3. {{{ #!python from __future__ import unicode_literals class Teacher(models.Model): students_ = models.ManyToManyField(Student, name='students') # Here the name is a unicode string because of the future import. }}} Raises: {{{ TypeError: Error when calling the metaclass bases type() argument 1 must be string, not unicode }}} The culprit is this [https://github.com/django/django/blob/8d05e6c0c7fe35df86799fa2fdcdb6499a4f6312/django/db/models/fields/related.py#L1312 line]. It should always be a `str`. This was not introduced by the codebase port to Python 3 and thus it's not a release blocker. Attaching a simple patch with tests in a few moments." Bug closed Database layer (models, ORM) master Normal fixed Ready for checkin 1 0 0 0 0 0