from __future__ import unicode_literals

from django.db import models
# from modeltrans.fields import TranslationField


class Category(models.Model):
    name = models.CharField(max_length=255)

    # i18n = TranslationField(fields=('name', ))

    class Meta:
        verbose_name_plural = 'categories'

    def __str__(self):
        return self.name


class Blog(models.Model):
    title = models.CharField(max_length=255)
    body = models.TextField(null=True, blank=True)

    category = models.ForeignKey(Category, null=True, blank=True)

    # i18n = TranslationField(fields=('title', 'body'))

    def __str__(self):
        return self.title

from __future__ import unicode_literals

from django.db import models
# from modeltrans.fields import TranslationField


class Category(models.Model):
    name = models.CharField(max_length=255)

    # i18n = TranslationField(fields=('name', ), virtual_fields=False)

    class Meta:
        verbose_name_plural = 'categories'

    def __str__(self):
        return self.name


class Blog(models.Model):
    title = models.CharField(max_length=255)
    body = models.TextField(null=True, blank=True)

    category = models.ForeignKey(Category, null=True, blank=True)

    # i18n = TranslationField(fields=('title', 'body'), virtual_fields=False)

    def __str__(self):
        return self.title

Disable adding virtual fields during migration
Disable adding virtual fields during migration

  from __future__ import unicode_literals
  
  from django.db import models
  # from modeltrans.fields import TranslationField
  
  
  class Category(models.Model):
      name = models.CharField(max_length=255)
  
-     # i18n = TranslationField(fields=('name', ))
+     # i18n = TranslationField(fields=('name', ), virtual_fields=False)
  
      class Meta:
          verbose_name_plural = 'categories'
  
      def __str__(self):
          return self.name
  
  
  class Blog(models.Model):
      title = models.CharField(max_length=255)
      body = models.TextField(null=True, blank=True)
  
      category = models.ForeignKey(Category, null=True, blank=True)
  
-     # i18n = TranslationField(fields=('title', 'body'))
+     # i18n = TranslationField(fields=('title', 'body'), virtual_fields=False)
  
      def __str__(self):
          return self.title
  
Disable adding virtual fields during migration
## Code Before:
from __future__ import unicode_literals

from django.db import models
# from modeltrans.fields import TranslationField


class Category(models.Model):
    name = models.CharField(max_length=255)

    # i18n = TranslationField(fields=('name', ))

    class Meta:
        verbose_name_plural = 'categories'

    def __str__(self):
        return self.name


class Blog(models.Model):
    title = models.CharField(max_length=255)
    body = models.TextField(null=True, blank=True)

    category = models.ForeignKey(Category, null=True, blank=True)

    # i18n = TranslationField(fields=('title', 'body'))

    def __str__(self):
        return self.title

## Instruction:
Disable adding virtual fields during migration
## Code After:
from __future__ import unicode_literals

from django.db import models
# from modeltrans.fields import TranslationField


class Category(models.Model):
    name = models.CharField(max_length=255)

    # i18n = TranslationField(fields=('name', ), virtual_fields=False)

    class Meta:
        verbose_name_plural = 'categories'

    def __str__(self):
        return self.name


class Blog(models.Model):
    title = models.CharField(max_length=255)
    body = models.TextField(null=True, blank=True)

    category = models.ForeignKey(Category, null=True, blank=True)

    # i18n = TranslationField(fields=('title', 'body'), virtual_fields=False)

    def __str__(self):
        return self.title
