<s> from django . db import models <EOL> from django_fsm import FSMField , FSMKeyField , transition <EOL> class Application ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> state = FSMField ( default = '<STR_LIT>' ) <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def draft ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = [ '<STR_LIT>' , '<STR_LIT>' ] , target = '<STR_LIT>' ) <EOL> def to_approvement ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def dept_approved ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def dept_rejected ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def dean_approved ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def dean_rejected ( self ) : <EOL> pass <EOL> class FKApplication ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> state = FSMKeyField ( '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def draft ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = [ '<STR_LIT>' , '<STR_LIT>' ] , target = '<STR_LIT>' ) <EOL> def to_approvement ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def dept_approved ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def dept_rejected ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def dean_approved ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' ) <EOL> def dean_rejected ( self ) : <EOL> pass <EOL> class DbState ( models . Model ) : <EOL> '''<STR_LIT>''' <EOL> id = models . CharField ( primary_key = True , max_length = <NUM_LIT:50> ) <EOL> label = models . CharField ( max_length = <NUM_LIT:255> ) <EOL> def __unicode__ ( self ) : <EOL> return self . label <EOL> class BlogPost ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> state = FSMField ( default = '<STR_LIT>' , protected = True ) <EOL> def can_restore ( self , user ) : <EOL> return user . is_superuser or user . is_staff <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' , <EOL> on_error = '<STR_LIT>' , permission = '<STR_LIT>' ) <EOL> def publish ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' ) <EOL> def notify_all ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' , on_error = '<STR_LIT>' , ) <EOL> def hide ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' , <EOL> on_error = '<STR_LIT>' , permission = lambda u : u . has_perm ( '<STR_LIT>' ) ) <EOL> def remove ( self ) : <EOL> raise Exception ( '<STR_LIT>' % self ) <EOL> @ transition ( field = state , source = '<STR_LIT>' , target = '<STR_LIT>' , <EOL> on_error = '<STR_LIT>' , permission = can_restore ) <EOL> def restore ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = [ '<STR_LIT>' , '<STR_LIT>' ] , target = '<STR_LIT>' ) <EOL> def steal ( self ) : <EOL> pass <EOL> @ transition ( field = state , source = '<STR_LIT:*>' , target = '<STR_LIT>' ) <EOL> def moderate ( self ) : <EOL> pass <EOL> class Meta : <EOL> permissions = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ] </s>
