Another solution i found is putting @python_2_unicode_compatible decorator on any model.
It also requires you to have a str implementation four your function
For example:
# models.py
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class SomeModel(models.Model):
name = Models.CharField(max_length=255)
def __str__(self):
return self.name
Use a Base model for all your models which exposes objects:
class BaseModel(models.Model):
objects = models.Manager()
class Meta:
abstract = True
class Model1(BaseModel):
id = models.AutoField(primary_key=True)
class Model2(BaseModel):
id = models.AutoField(primary_key=True)