<s> from django . core . urlresolvers import reverse <EOL> from django . db import models <EOL> from utils import slugify <EOL> class Event ( models . Model ) : <EOL> title = models . CharField ( max_length = <NUM_LIT> ) <EOL> description = models . TextField ( blank = True ) <EOL> address = models . TextField ( max_length = <NUM_LIT> , blank = True ) <EOL> start = models . DateTimeField ( db_index = True ) <EOL> is_published = models . BooleanField ( default = False ) <EOL> slug = models . SlugField ( editable = False ) <EOL> created_at = models . DateTimeField ( auto_now_add = True ) <EOL> def __unicode__ ( self ) : <EOL> return self . title <EOL> def get_absolute_url ( self ) : <EOL> url_args = ( <EOL> self . start . year , self . start . month , self . start . day , self . slug <EOL> ) <EOL> return reverse ( '<STR_LIT>' , args = url_args ) <EOL> def save ( self , ** kwargs ) : <EOL> self . slug = slugify ( self . title ) <EOL> return super ( Event , self ) . save ( ** kwargs ) <EOL> class Meta : <EOL> ordering = ( '<STR_LIT:start>' , ) </s>
