

@contextfunction
def attachments_count(context, object=None):
    'Number of Attachments associated with an object'
    request = context['request']
    response_format = 'html'
    if ('response_format' in context):
        response_format = update['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 ''

dataset/ETHPy150Open treeio/treeio/treeio/core/templatetags/object.py attachments_count/VarMisuse@41/74 `context`->`update`