<s> """<STR_LIT>""" <EOL> from django . db import models , transaction <EOL> class LatestArticleRevision ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> article_id = models . BigIntegerField ( unique = True ) <EOL> title = models . CharField ( max_length = <NUM_LIT> , null = False , blank = False ) <EOL> content = models . TextField ( blank = True ) <EOL> search_classname = '<STR_LIT>' <EOL> @ classmethod <EOL> def copy_article_revision ( kls , revision ) : <EOL> """<STR_LIT>""" <EOL> with transaction . commit_on_success ( ) : <EOL> latest_article , lar_created = kls . objects . get_or_create ( <EOL> article_id = revision . article . id , <EOL> ) <EOL> latest_article . title = revision . title <EOL> latest_article . content = revision . content <EOL> latest_article . save ( ) <EOL> @ classmethod <EOL> def purge ( kls , article ) : <EOL> """<STR_LIT>""" <EOL> kls . objects . filter ( article_id = article . id ) . delete ( ) <EOL> def __unicode__ ( self ) : <EOL> return self . title <EOL> @ models . permalink <EOL> def get_absolute_url ( self ) : <EOL> return ( '<STR_LIT>' , ( self . article_id , ) ) </s>
