def default_template(request, event_url_name):
    event = get_object_or_404(Event, url_name=event_url_name)

    # check permission
    if not has_access(request.user, event, ACCESS_BADGES_EDIT):
        return nopermission(request)

    # check if badge system is active
    if not event.badges:
        return notactive(request)

    # output
    response = HttpResponse(content_type='application/x-tex')
    response['Content-Disposition'] = 'attachment; filename="template.tex"'

    # send file
    with open(django_settings.BADGE_DEFAULT_TEMPLATE, 'rb') as f:
        response.write(f.read())

    return response