from django.http import HttpResponse, Http404, FileResponse
from admin_interface.templatetags.admin_interface_tags import get_admin_interface_theme

def get_logo_url():
    theme = get_admin_interface_theme()
    return theme.logo.url

def get_inter_Dict(user, context_Dict):
    form_name = None

    Dict = {}

    from ServicesApp.funcs import get_sections
    sections = get_sections()

    if 'page' in context_Dict and context_Dict['page']:
        fb_block = context_Dict['page'].get_feedback_block()
        if fb_block:
            form_name = fb_block.name

    if form_name:
        from .forms import FeedbackForm
        feedback_form = FeedbackForm()
        feedback_form.initial = {'form_name': form_name}
        Dict.update({'feedback_form': feedback_form})

    Dict.update({
        'sections': sections,
        'logo': get_logo_url(),
    })
    # from SubscribesApp.funcs import get_cur_user_subscribe
    # user_subscribe = get_cur_user_subscribe(user)

    # Dict.update({'user_subscribe': user_subscribe})

    return Dict

def get_inter_http_respose(template_obj, context_Dict, request):

    context_Dict.update(get_inter_Dict(request.user, context_Dict))

    return HttpResponse(template_obj.render(context_Dict, request))