<s> from django . core . exceptions import ImproperlyConfigured <EOL> from django . core . urlresolvers import reverse <EOL> from django . template import ( <EOL> Library , TemplateSyntaxError ) <EOL> register = Library ( ) <EOL> @ register . inclusion_tag ( <EOL> '<STR_LIT>' , <EOL> takes_context = True ) <EOL> def form ( context , * args , ** kwargs ) : <EOL> action = ( args [ <NUM_LIT:0> ] if len ( args ) > <NUM_LIT:0> <EOL> else kwargs . get ( '<STR_LIT:action>' ) ) <EOL> button = ( args [ <NUM_LIT:1> ] if len ( args ) > <NUM_LIT:1> <EOL> else kwargs . get ( '<STR_LIT>' ) ) <EOL> method = ( args [ <NUM_LIT:2> ] if len ( args ) > <NUM_LIT:2> <EOL> else kwargs . get ( '<STR_LIT>' ) ) <EOL> form = context . get ( '<STR_LIT>' ) <EOL> if action is None : <EOL> raise TemplateSyntaxError ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return { <EOL> '<STR_LIT:action>' : action , <EOL> '<STR_LIT>' : button , <EOL> '<STR_LIT>' : form , <EOL> '<STR_LIT>' : method } <EOL> @ register . inclusion_tag ( <EOL> '<STR_LIT>' , <EOL> takes_context = True ) <EOL> def delete_form ( context , * args , ** kwargs ) : <EOL> action = ( args [ <NUM_LIT:0> ] if len ( args ) > <NUM_LIT:0> <EOL> else kwargs . get ( '<STR_LIT:action>' ) ) <EOL> method = ( args [ <NUM_LIT:1> ] if len ( args ) > <NUM_LIT:1> <EOL> else kwargs . get ( '<STR_LIT>' ) ) <EOL> form = context . get ( '<STR_LIT>' ) <EOL> display_object = kwargs . get ( <EOL> '<STR_LIT:object>' , context . get ( '<STR_LIT:object>' ) ) <EOL> if action is None : <EOL> raise TemplateSyntaxError ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if display_object is None : <EOL> raise TemplateSyntaxError ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if hasattr ( display_object , '<STR_LIT:name>' ) : <EOL> obj_title = display_object . name <EOL> elif hasattr ( display_object , '<STR_LIT:title>' ) : <EOL> obj_title = display_object . title . title ( ) <EOL> else : <EOL> obj_title = str ( display_object ) <EOL> obj_type = kwargs . get ( <EOL> '<STR_LIT>' , <EOL> display_object . _meta . verbose_name . title ( ) ) <EOL> return { <EOL> '<STR_LIT:action>' : action , <EOL> '<STR_LIT>' : form , <EOL> '<STR_LIT>' : method , <EOL> '<STR_LIT:object>' : display_object , <EOL> '<STR_LIT>' : obj_title , <EOL> '<STR_LIT>' : obj_type } </s>
