from django.db import models

from .. import abstract_models
from ..manager import PageManager


class PageType(abstract_models.AbstractPageType):
    class Meta:
        app_label = 'fancypages'


class VisibilityType(abstract_models.AbstractVisibilityType):
    class Meta:
        app_label = 'fancypages'


class FancyPage(abstract_models.AbstractTreeNode,
                abstract_models.AbstractFancyPage):
    objects = PageManager()

    class Meta:
        app_label = 'fancypages'


class Container(abstract_models.AbstractContainer):
    class Meta:
        app_label = 'fancypages'
        unique_together = (('name', 'content_type', 'object_id'),)


class OrderedContainer(Container):
    display_order = models.PositiveIntegerField()

    def __unicode__(self):
        return u"Container #%d '%s' in '%s'" % (
            self.display_order,
            self.name,
            self.content_type
        )

    class Meta:
        app_label = 'fancypages'

from django.db import models

from .. import abstract_models
from ..manager import PageManager


class PageType(abstract_models.AbstractPageType):
    class Meta:
        app_label = 'fancypages'


class VisibilityType(abstract_models.AbstractVisibilityType):
    class Meta:
        app_label = 'fancypages'


class FancyPage(abstract_models.AbstractTreeNode,
                abstract_models.AbstractFancyPage):
    objects = PageManager()

    class Meta:
        app_label = 'fancypages'


class Container(abstract_models.AbstractContainer):
    class Meta:
        app_label = 'fancypages'
        unique_together = (('name', 'content_type', 'object_id'),)


class OrderedContainer(Container):
    display_order = models.PositiveIntegerField()

    def __unicode__(self):
        return u"Container #{0} '{1}' in '{2}'".format(
            self.display_order,
            self.name,
            self.content_type
        )

    class Meta:
        app_label = 'fancypages'

Change string formatting to use format
Change string formatting to use format

  from django.db import models
  
  from .. import abstract_models
  from ..manager import PageManager
  
  
  class PageType(abstract_models.AbstractPageType):
      class Meta:
          app_label = 'fancypages'
  
  
  class VisibilityType(abstract_models.AbstractVisibilityType):
      class Meta:
          app_label = 'fancypages'
  
  
  class FancyPage(abstract_models.AbstractTreeNode,
                  abstract_models.AbstractFancyPage):
      objects = PageManager()
  
      class Meta:
          app_label = 'fancypages'
  
  
  class Container(abstract_models.AbstractContainer):
      class Meta:
          app_label = 'fancypages'
          unique_together = (('name', 'content_type', 'object_id'),)
  
  
  class OrderedContainer(Container):
      display_order = models.PositiveIntegerField()
  
      def __unicode__(self):
-         return u"Container #%d '%s' in '%s'" % (
+         return u"Container #{0} '{1}' in '{2}'".format(
              self.display_order,
              self.name,
              self.content_type
          )
  
      class Meta:
          app_label = 'fancypages'
  
Change string formatting to use format
## Code Before:
from django.db import models

from .. import abstract_models
from ..manager import PageManager


class PageType(abstract_models.AbstractPageType):
    class Meta:
        app_label = 'fancypages'


class VisibilityType(abstract_models.AbstractVisibilityType):
    class Meta:
        app_label = 'fancypages'


class FancyPage(abstract_models.AbstractTreeNode,
                abstract_models.AbstractFancyPage):
    objects = PageManager()

    class Meta:
        app_label = 'fancypages'


class Container(abstract_models.AbstractContainer):
    class Meta:
        app_label = 'fancypages'
        unique_together = (('name', 'content_type', 'object_id'),)


class OrderedContainer(Container):
    display_order = models.PositiveIntegerField()

    def __unicode__(self):
        return u"Container #%d '%s' in '%s'" % (
            self.display_order,
            self.name,
            self.content_type
        )

    class Meta:
        app_label = 'fancypages'

## Instruction:
Change string formatting to use format
## Code After:
from django.db import models

from .. import abstract_models
from ..manager import PageManager


class PageType(abstract_models.AbstractPageType):
    class Meta:
        app_label = 'fancypages'


class VisibilityType(abstract_models.AbstractVisibilityType):
    class Meta:
        app_label = 'fancypages'


class FancyPage(abstract_models.AbstractTreeNode,
                abstract_models.AbstractFancyPage):
    objects = PageManager()

    class Meta:
        app_label = 'fancypages'


class Container(abstract_models.AbstractContainer):
    class Meta:
        app_label = 'fancypages'
        unique_together = (('name', 'content_type', 'object_id'),)


class OrderedContainer(Container):
    display_order = models.PositiveIntegerField()

    def __unicode__(self):
        return u"Container #{0} '{1}' in '{2}'".format(
            self.display_order,
            self.name,
            self.content_type
        )

    class Meta:
        app_label = 'fancypages'
