old_contents: from django.db import models
  from django.utils.safestring import mark_safe
  from django.utils.translation import ugettext_lazy as _
  
  
  class ImageContent(models.Model):
      BLOCK = 'block'
      LEFT = 'left'
      RIGHT = 'right'
  
      POSITION_CHOICES = (
          (BLOCK, _('block')),
          (LEFT, _('left')),
          (RIGHT, _('right')),
          )
  
      CSS_SPEC = {
          BLOCK: 'display:block;',
          LEFT: 'float:left;',
          RIGHT: 'float:right',
          }
  
      image = models.ImageField(_('image'), upload_to='imagecontent')
      position = models.CharField(max_length=10, choices=POSITION_CHOICES, default=BLOCK)
  
      class Meta:
          abstract = True
  
      def render(self, **kwargs):
          return mark_safe(u'<img src="%s" alt="" style="%s" />' % (
              self.image.url,
              self.CSS_SPEC[self.position]))
  
  
new_contents: from django.db import models
  from django.template.loader import render_to_string
  from django.utils.translation import ugettext_lazy as _
  
  class ImageContent(models.Model):
      """
      Create an ImageContent like this:
  
      Cls.create_content_type(ImageContent, POSITION_CHOICES=(
          ('left', 'Left'),
          ('right', Right'),
          ))
      """
  
      image = models.ImageField(_('image'), upload_to='imagecontent')
  
      class Meta:
          abstract = True
  
      def render(self, **kwargs):
          return render_to_string([
              'content/image/%s.html' % self.position,
              'content/image/default.html',
              ], {'content': self})
  
      @classmethod
      def handle_kwargs(cls, POSITION_CHOICES=()):
          models.CharField(_('Position'), max_length=10, choices=POSITION_CHOICES
              ).contribute_to_class(cls, 'position')
  
  
subject: Make ImageContent's positions customizable