@contextfunction
def attachments_count(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):
  count = Attachment.objects.filter(attached_object=object).count()
 else:
  count = Attachment.objects.filter(attached_record=object).count()
 if count:
  return Markup(render_to_string('core/tags/attachments_count', {'count': count}, context_instance=RequestContext(request), response_format=response_format))
 else:
  return ''

@ contextfunction def attachments_count ( 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 ) : count = Attachment . objects . filter ( attached_object = object ) . count ( ) else : count = Attachment . objects . filter ( attached_record = object ) . count ( ) if count : return Markup ( render_to_string ( 'core/tags/attachments_count' , { 'count' : count } , context_instance = RequestContext ( request ) , response_format = response_format ) ) else : return ''
number of attachments associated with an object .