<s> from __future__ import unicode_literals <EOL> from datetime import datetime <EOL> import django <EOL> from django . db import models <EOL> from django . db . models import permalink <EOL> from django . utils . encoding import python_2_unicode_compatible <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> class PublicManager ( models . Manager ) : <EOL> """<STR_LIT>""" <EOL> if django . VERSION < ( <NUM_LIT:1> , <NUM_LIT:6> ) : <EOL> get_queryset = models . Manager . get_query_set <EOL> def published ( self ) : <EOL> return self . get_queryset ( ) . filter ( publish__lte = datetime . now ( ) ) <EOL> @ python_2_unicode_compatible <EOL> class Story ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> title = models . CharField ( '<STR_LIT:title>' , max_length = <NUM_LIT:200> ) <EOL> slug = models . SlugField ( '<STR_LIT>' , unique_for_date = '<STR_LIT>' ) <EOL> body = models . TextField ( '<STR_LIT:body>' ) <EOL> allow_comments = models . BooleanField ( '<STR_LIT>' , default = True ) <EOL> publish = models . DateTimeField ( '<STR_LIT>' , default = datetime . now ) <EOL> objects = PublicManager ( ) <EOL> class Meta : <EOL> db_table = '<STR_LIT>' <EOL> ordering = ( '<STR_LIT>' , ) <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT:%s>' % self . title <EOL> @ permalink <EOL> def get_absolute_url ( self ) : <EOL> return ( '<STR_LIT>' , None , <EOL> { '<STR_LIT>' : self . publish . year , <EOL> '<STR_LIT>' : int ( self . publish . strftime ( '<STR_LIT>' ) . lower ( ) ) , <EOL> '<STR_LIT>' : self . publish . day , <EOL> '<STR_LIT>' : self . slug } ) <EOL> @ python_2_unicode_compatible <EOL> class Quote ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> title = models . CharField ( '<STR_LIT:title>' , max_length = <NUM_LIT:100> ) <EOL> slug = models . SlugField ( '<STR_LIT>' , max_length = <NUM_LIT:255> , unique = True ) <EOL> quote = models . TextField ( '<STR_LIT>' ) <EOL> author = models . CharField ( '<STR_LIT>' , max_length = <NUM_LIT:255> ) <EOL> url_source = models . URLField ( '<STR_LIT>' , blank = True , null = True ) <EOL> allow_comments = models . BooleanField ( '<STR_LIT>' , default = True ) <EOL> publish = models . DateTimeField ( '<STR_LIT>' , default = datetime . now ) <EOL> objects = PublicManager ( ) <EOL> class Meta : <EOL> db_table = '<STR_LIT>' <EOL> ordering = ( '<STR_LIT>' , ) <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT:%s>' % self . title <EOL> @ models . permalink <EOL> def get_absolute_url ( self ) : <EOL> return ( '<STR_LIT>' , ( ) , { '<STR_LIT>' : self . slug } ) </s>
