<s> from django . core . urlresolvers import reverse <EOL> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from jsonfield import JSONField <EOL> from markupfield . fields import MarkupField <EOL> from cms . models import ContentManageable <EOL> from . managers import PostQuerySet <EOL> DEFAULT_MARKUP_TYPE = '<STR_LIT:html>' <EOL> '''<STR_LIT>''' <EOL> class Post ( ContentManageable ) : <EOL> title = models . CharField ( max_length = <NUM_LIT:200> , blank = True , null = True ) <EOL> content = MarkupField ( default_markup_type = DEFAULT_MARKUP_TYPE ) <EOL> abstract = models . TextField ( blank = True , null = True ) <EOL> MEDIA_TEXT = <NUM_LIT:1> <EOL> MEDIA_PHOTO = <NUM_LIT:2> <EOL> MEDIA_VIDEO = <NUM_LIT:3> <EOL> MEDIA_LINK = <NUM_LIT:4> <EOL> MEDIA_CHOICES = ( <EOL> ( MEDIA_TEXT , '<STR_LIT:text>' ) , <EOL> ( MEDIA_PHOTO , '<STR_LIT>' ) , <EOL> ( MEDIA_VIDEO , '<STR_LIT>' ) , <EOL> ( MEDIA_LINK , '<STR_LIT>' ) , <EOL> ) <EOL> media_type = models . IntegerField ( choices = MEDIA_CHOICES , default = MEDIA_TEXT ) <EOL> source_url = models . URLField ( max_length = <NUM_LIT:1000> , blank = True ) <EOL> meta = JSONField ( blank = True , default = { } ) <EOL> STATUS_PRIVATE = <NUM_LIT:1> <EOL> STATUS_PUBLIC = <NUM_LIT:2> <EOL> STATUS_CHOICES = ( <EOL> ( STATUS_PRIVATE , '<STR_LIT>' ) , <EOL> ( STATUS_PUBLIC , '<STR_LIT>' ) , <EOL> ) <EOL> status = models . IntegerField ( choices = STATUS_CHOICES , default = STATUS_PRIVATE , db_index = True ) <EOL> objects = PostQuerySet . as_manager ( ) <EOL> class Meta : <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> get_latest_by = '<STR_LIT>' <EOL> ordering = [ '<STR_LIT>' ] <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . get_media_type_display ( ) , self . pk ) <EOL> def get_absolute_url ( self ) : <EOL> return reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . pk } ) <EOL> class Link ( ContentManageable ) : <EOL> post = models . ForeignKey ( Post , related_name = '<STR_LIT>' , editable = False , null = True ) <EOL> url = models . URLField ( '<STR_LIT>' , max_length = <NUM_LIT:1000> , blank = True ) <EOL> class Meta : <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> get_latest_by = '<STR_LIT>' <EOL> ordering = [ '<STR_LIT>' ] <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . pk ) <EOL> class Photo ( ContentManageable ) : <EOL> post = models . ForeignKey ( Post , related_name = '<STR_LIT>' , editable = False , null = True ) <EOL> image = models . ImageField ( upload_to = '<STR_LIT>' , blank = True ) <EOL> image_url = models . URLField ( '<STR_LIT>' , max_length = <NUM_LIT:1000> , blank = True ) <EOL> caption = models . TextField ( blank = True ) <EOL> click_through_url = models . URLField ( blank = True ) <EOL> class Meta : <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> get_latest_by = '<STR_LIT>' <EOL> ordering = [ '<STR_LIT>' ] <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . pk ) <EOL> class Video ( ContentManageable ) : <EOL> post = models . ForeignKey ( Post , related_name = '<STR_LIT>' , editable = False , null = True ) <EOL> video_embed = models . TextField ( blank = True ) <EOL> video_data = models . FileField ( upload_to = '<STR_LIT>' , blank = True , ) <EOL> caption = models . TextField ( blank = True ) <EOL> click_through_url = models . URLField ( '<STR_LIT>' , blank = True ) <EOL> class Meta : <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> get_latest_by = '<STR_LIT>' <EOL> ordering = [ '<STR_LIT>' ] <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . pk ) </s>
