Beispiel #1
0
def real_time_box_settings(request):
    from forms import DashboardSettingsForm
    if request.POST:
        form = DashboardSettingsForm(request.POST)
        if form.is_valid():
            request.organization.dashboard_variable1 = request.POST['dashboard_variable1']
            #request.organization.dashboard_variable2 = request.POST['dashboard_variable2']
            request.organization.save()
            referer = request.META.get('HTTP_REFERER', None)
            if referer == None:
                return HttpResponseRedirect("/publisher/")
            else:
                return HttpResponseRedirect(referer)
    else:
        inits = {
            'dashboard_variable1':request.organization.dashboard_variable1,
            #'dashboard_variable2':request.organization.dashboard_variable2
        }
        form = DashboardSettingsForm(inits)
    if request.organization.is_advertiser():
        org_type="advertiser"
    else:
        org_type="publisher"
    return AQ_render_to_response(request, 'base/real-time-settings.html', { 
                        'var_choices':DASHBOARDMETRIC_CHOICES,
                        'form':form,
                        'org_type':org_type }, context_instance=RequestContext(request))
Beispiel #2
0
def real_time_box_settings(request):
    from forms import DashboardSettingsForm
    if request.POST:
        form = DashboardSettingsForm(request.POST)
        if form.is_valid():
            request.organization.dashboard_variable1 = request.POST[
                'dashboard_variable1']
            #request.organization.dashboard_variable2 = request.POST['dashboard_variable2']
            request.organization.save()
            referer = request.META.get('HTTP_REFERER', None)
            if referer == None:
                return HttpResponseRedirect("/publisher/")
            else:
                return HttpResponseRedirect(referer)
    else:
        inits = {
            'dashboard_variable1': request.organization.dashboard_variable1,
            #'dashboard_variable2':request.organization.dashboard_variable2
        }
        form = DashboardSettingsForm(inits)
    if request.organization.is_advertiser():
        org_type = "advertiser"
    else:
        org_type = "publisher"
    return AQ_render_to_response(request,
                                 'base/real-time-settings.html', {
                                     'var_choices': DASHBOARDMETRIC_CHOICES,
                                     'form': form,
                                     'org_type': org_type
                                 },
                                 context_instance=RequestContext(request))
Beispiel #3
0
def publisher_dashboard_settings(request):

    from atrinsic.base.models import UserAqWidget
    from forms import DashboardSettingsForm

    if request.method == 'POST':
        form = DashboardSettingsForm(request.POST)
        if form.is_valid():
            widget = UserAqWidget.objects.get(pk=request.POST['wid'])
            widget.custom_group = form.cleaned_data.get(
                'dashboard_group_data_by', 0)
            widget.custom_columns = str(
                form.cleaned_data['dashboard_variable1']) + "," + str(
                    form.cleaned_data['dashboard_variable2'])
            request.organization.dashboard_variable1 = form.cleaned_data[
                'dashboard_variable1']
            request.organization.dashboard_variable2 = form.cleaned_data[
                'dashboard_variable2']
            request.organization.save()
            db_date_string = ''
            if (request.POST.has_key("start_date")):
                if (request.POST['start_date'] !=
                        "") & (request.POST['start_date'] != None):
                    db_date_string += str(request.POST['start_date'])
                    if request.POST.has_key("end_date"):
                        if (request.POST['end_date'] !=
                                "") & (request.POST['end_date'] != None):
                            db_date_string += ',' + str(
                                request.POST['end_date'])
            widget.custom_date_range = db_date_string
            widget.save()
    return HttpResponseRedirect('/publisher/')
def publisher_dashboard_settings(request):

    from atrinsic.base.models import UserAqWidget
    from forms import DashboardSettingsForm
    
    if request.method == 'POST':
        form = DashboardSettingsForm(request.POST)
        if form.is_valid():
            widget = UserAqWidget.objects.get(pk=request.POST['wid'])
            widget.custom_group = form.cleaned_data.get('dashboard_group_data_by',0)
            widget.custom_columns = str(form.cleaned_data['dashboard_variable1'])+","+str(form.cleaned_data['dashboard_variable2'])
            request.organization.dashboard_variable1 = form.cleaned_data['dashboard_variable1']
            request.organization.dashboard_variable2 = form.cleaned_data['dashboard_variable2']
            request.organization.save()
            db_date_string = ''
            if (request.POST.has_key("start_date")):
                if (request.POST['start_date'] != "") & (request.POST['start_date'] != None):
                    db_date_string+=str(request.POST['start_date'])
                    if request.POST.has_key("end_date"):
                        if (request.POST['end_date'] != "") & (request.POST['end_date'] != None):
                            db_date_string+=','+str(request.POST['end_date'])
            widget.custom_date_range = db_date_string
            widget.save()
    return HttpResponseRedirect('/publisher/')