<s> from django . conf import settings <EOL> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from leonardo . module . media . fields . folder import FolderField <EOL> from leonardo . module . web . models import ListWidget <EOL> from leonardo . module . web . widgets . forms import WidgetUpdateForm <EOL> from django . core . urlresolvers import reverse_lazy <EOL> from leonardo . module . media . models import Image <EOL> DETAIL_CHOICES = ( <EOL> ( '<STR_LIT>' , _ ( '<STR_LIT>' ) ) , <EOL> ( '<STR_LIT>' , _ ( '<STR_LIT>' ) ) , <EOL> ( '<STR_LIT>' , _ ( '<STR_LIT>' ) ) , <EOL> ) <EOL> SIZE_CHOICES = ( <EOL> ( '<STR_LIT>' , _ ( '<STR_LIT>' ) ) , <EOL> ( '<STR_LIT>' , _ ( '<STR_LIT>' ) ) , <EOL> ( '<STR_LIT>' , _ ( '<STR_LIT>' ) ) , <EOL> ) <EOL> class FolderForm ( WidgetUpdateForm ) : <EOL> folder = FolderField ( ) <EOL> class MediaGalleryWidget ( ListWidget ) : <EOL> feincms_item_editor_form = FolderForm <EOL> icon = "<STR_LIT>" <EOL> folder = models . ForeignKey ( '<STR_LIT>' , verbose_name = _ ( <EOL> "<STR_LIT>" ) , related_name = "<STR_LIT>" ) <EOL> size = models . CharField ( max_length = <NUM_LIT:255> , verbose_name = _ ( <EOL> "<STR_LIT>" ) , choices = SIZE_CHOICES , default = '<STR_LIT>' ) <EOL> detail = models . CharField ( max_length = <NUM_LIT:255> , verbose_name = _ ( <EOL> "<STR_LIT>" ) , choices = DETAIL_CHOICES , default = '<STR_LIT>' ) <EOL> def get_size ( self ) : <EOL> return getattr ( settings , <EOL> '<STR_LIT>' % self . size . upper ( ) , <EOL> '<STR_LIT>' ) <EOL> def get_items ( self ) : <EOL> return self . folder . media_file_files . instance_of ( Image ) <EOL> class Meta : <EOL> abstract = True <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) </s>
