<s> import re <EOL> from django . db import models <EOL> from django . utils . translation import ugettext as _ <EOL> from tumblelog import actions , filters <EOL> from tumblelog . models . base import BasePostType <EOL> from tumblelog . settings import TEXTFIELD_HELP_TEXT <EOL> class File ( BasePostType ) : <EOL> """<STR_LIT>""" <EOL> file_file = models . FileField ( _ ( '<STR_LIT>' ) , <EOL> upload_to = '<STR_LIT>' <EOL> ) <EOL> file_name = models . CharField ( _ ( '<STR_LIT>' ) , <EOL> max_length = <NUM_LIT> , <EOL> blank = True , <EOL> null = True , <EOL> help_text = _ ( '<STR_LIT>' ) <EOL> ) <EOL> description = models . TextField ( _ ( '<STR_LIT>' ) , <EOL> blank = True , <EOL> null = True , <EOL> help_text = TEXTFIELD_HELP_TEXT <EOL> ) <EOL> class Meta : <EOL> app_label = '<STR_LIT>' <EOL> verbose_name = '<STR_LIT>' <EOL> verbose_name_plural = '<STR_LIT>' <EOL> class TumblelogMeta : <EOL> actions = [ <EOL> actions . mark_as_published , <EOL> actions . mark_as_draft , <EOL> ] <EOL> date_hierarchy = '<STR_LIT>' <EOL> fieldsets = ( <EOL> ( None , { <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT:title>' , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , ) , <EOL> '<STR_LIT:description>' , <EOL> ) , <EOL> } ) , <EOL> ( _ ( '<STR_LIT:Meta>' ) , { <EOL> '<STR_LIT>' : ( '<STR_LIT>' , ) , <EOL> '<STR_LIT>' : ( '<STR_LIT:status>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , ) <EOL> } ) , <EOL> ) <EOL> list_display = ( <EOL> '<STR_LIT:title>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:status>' , <EOL> ) <EOL> list_filter = ( <EOL> filters . PubliclyVisibleListFilter , <EOL> filters . PublicationDateListFilter , <EOL> filters . StatusListFilter , <EOL> '<STR_LIT>' , <EOL> ) <EOL> prepopulated_fields = { <EOL> '<STR_LIT>' : ( '<STR_LIT:title>' , ) <EOL> } <EOL> search_fields = [ <EOL> '<STR_LIT:title>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:description>' , <EOL> ] <EOL> def get_filename ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . file_file : <EOL> try : <EOL> return re . search ( r'<STR_LIT>' , self . file_file ) . groups ( ) [ <NUM_LIT:0> ] <EOL> except AttributeError : <EOL> pass <EOL> return None <EOL> @ property <EOL> def file_link_text ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . file_name : <EOL> return self . file_name <EOL> return self . get_filename ( ) </s>
