from django.db import models

from ..base import ModelTranslationBase
from ..mixins import ModelMixin, ManagerMixin


class FooManager(ManagerMixin, models.Manager):
    pass


class BarManager(ManagerMixin, models.Manager):
    pass


class FooModel(ModelMixin, models.Model):
    title = models.CharField(max_length=255, null=True, blank=True)
    excerpt = models.TextField(null=True, blank=True)
    body = models.TextField(null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    objects = FooManager()


class FooTranslation(ModelTranslationBase):
    model = FooModel
    identifier = 'foo'
    fields = ('title', 'excerpt', 'body')


class BarModel(ModelMixin, models.Model):
    title = models.CharField(max_length=255, null=True, blank=True)
    objects = BarManager()


class BarTranslation(ModelTranslationBase):
    model = BarModel
    identifier = 'bar'
    fields = ('title', )


class BadTranslation(object):
    pass


class BadModel(object):
    pass

from django.db import models

from ..base import ModelTranslationBase
from ..mixins import ModelMixin, ManagerMixin


class FooManager(ManagerMixin, models.Manager):
    pass


class BarManager(ManagerMixin, models.Manager):
    pass


class FooModel(ModelMixin, models.Model):
    title = models.CharField(max_length=255)
    excerpt = models.TextField(null=True, blank=True)
    body = models.TextField(null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    objects = FooManager()

    class Meta:
        linguist = {
            'identifier': 'foo',
            'fields': ('title', 'excerpt', 'body'),
        }


class BarModel(ModelMixin, models.Model):
    title = models.CharField(max_length=255, null=True, blank=True)
    objects = BarManager()

    class Meta:
        linguist = {
            'identifier': 'bar',
            'fields': ('title', ),
        }


class BadTranslation(object):
    pass


class BadModel(object):
    pass

Update test models for new metaclass support.
Update test models for new metaclass support.

  from django.db import models
  
  from ..base import ModelTranslationBase
  from ..mixins import ModelMixin, ManagerMixin
  
  
  class FooManager(ManagerMixin, models.Manager):
      pass
  
  
  class BarManager(ManagerMixin, models.Manager):
      pass
  
  
  class FooModel(ModelMixin, models.Model):
-     title = models.CharField(max_length=255, null=True, blank=True)
+     title = models.CharField(max_length=255)
      excerpt = models.TextField(null=True, blank=True)
      body = models.TextField(null=True, blank=True)
      created_at = models.DateTimeField(auto_now_add=True)
      objects = FooManager()
  
+     class Meta:
+         linguist = {
+             'identifier': 'foo',
- 
- class FooTranslation(ModelTranslationBase):
-     model = FooModel
-     identifier = 'foo'
-     fields = ('title', 'excerpt', 'body')
+             'fields': ('title', 'excerpt', 'body'),
+         }
  
  
  class BarModel(ModelMixin, models.Model):
      title = models.CharField(max_length=255, null=True, blank=True)
      objects = BarManager()
  
+     class Meta:
+         linguist = {
+             'identifier': 'bar',
- 
- class BarTranslation(ModelTranslationBase):
-     model = BarModel
-     identifier = 'bar'
-     fields = ('title', )
+             'fields': ('title', ),
+         }
  
  
  class BadTranslation(object):
      pass
  
  
  class BadModel(object):
      pass
  
Update test models for new metaclass support.
## Code Before:
from django.db import models

from ..base import ModelTranslationBase
from ..mixins import ModelMixin, ManagerMixin


class FooManager(ManagerMixin, models.Manager):
    pass


class BarManager(ManagerMixin, models.Manager):
    pass


class FooModel(ModelMixin, models.Model):
    title = models.CharField(max_length=255, null=True, blank=True)
    excerpt = models.TextField(null=True, blank=True)
    body = models.TextField(null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    objects = FooManager()


class FooTranslation(ModelTranslationBase):
    model = FooModel
    identifier = 'foo'
    fields = ('title', 'excerpt', 'body')


class BarModel(ModelMixin, models.Model):
    title = models.CharField(max_length=255, null=True, blank=True)
    objects = BarManager()


class BarTranslation(ModelTranslationBase):
    model = BarModel
    identifier = 'bar'
    fields = ('title', )


class BadTranslation(object):
    pass


class BadModel(object):
    pass

## Instruction:
Update test models for new metaclass support.
## Code After:
from django.db import models

from ..base import ModelTranslationBase
from ..mixins import ModelMixin, ManagerMixin


class FooManager(ManagerMixin, models.Manager):
    pass


class BarManager(ManagerMixin, models.Manager):
    pass


class FooModel(ModelMixin, models.Model):
    title = models.CharField(max_length=255)
    excerpt = models.TextField(null=True, blank=True)
    body = models.TextField(null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    objects = FooManager()

    class Meta:
        linguist = {
            'identifier': 'foo',
            'fields': ('title', 'excerpt', 'body'),
        }


class BarModel(ModelMixin, models.Model):
    title = models.CharField(max_length=255, null=True, blank=True)
    objects = BarManager()

    class Meta:
        linguist = {
            'identifier': 'bar',
            'fields': ('title', ),
        }


class BadTranslation(object):
    pass


class BadModel(object):
    pass
