@contextfunction
def attachments_block(context, object=None):
 request = context['request']
 response_format = 'html'
 if ('response_format' in context):
  response_format = context['response_format']
 update = isinstance(object, UpdateRecord)
 if (not update):
  attachments = Attachment.objects.filter(attached_object=object)
  template = 'core/tags/attachments_block'
 else:
  attachments = Attachment.objects.filter(attached_record=object)
  template = 'core/tags/attachments_record_block'
 return Markup(render_to_string(template, {'object': object, 'attachments': attachments}, context_instance=RequestContext(request), response_format=response_format))

@ contextfunction def attachments_block ( context , object = None ) : request = context [ 'request' ] response_format = 'html' if ( 'response_format' in context ) : response_format = context [ 'response_format' ] update = isinstance ( object , UpdateRecord ) if ( not update ) : attachments = Attachment . objects . filter ( attached_object = object ) template = 'core/tags/attachments_block' else : attachments = Attachment . objects . filter ( attached_record = object ) template = 'core/tags/attachments_record_block' return Markup ( render_to_string ( template , { 'object' : object , 'attachments' : attachments } , context_instance = RequestContext ( request ) , response_format = response_format ) )
attachments for an object or update record .