#NEWLINE# def form_valid( self , form ) : #NEWLINE# #INDENT# self . object = form . save ( commit = False ) #NEWLINE# self . object . name = self . object . image . name #NEWLINE# self . object . creator = self . request . user #NEWLINE# self . object . save ( ) #NEWLINE# f = self . request . FILES . get ( 'image' ) #NEWLINE# template = loader . get_template ( self . thumbnail_template_name ) #NEWLINE# thumbnail_markup = template . render ( RequestContext ( self . request , { #NEWLINE# #INDENT# 'image_asset' : self . object , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# ctx = { #NEWLINE# #INDENT# 'images' : [ { #NEWLINE# #INDENT# 'name' : f . name , #NEWLINE# 'url' : self . object . get_absolute_url ( ) , #NEWLINE# 'thumbnailMarkup' : thumbnail_markup , #NEWLINE# 'deleteUrl' : '' , #NEWLINE# 'deleteType' : 'DELETE' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# return self . render_to_response ( ctx )