示例#1
0
文件: views.py 项目: google/mirandum
def setup(request):
    cred_count = AppCreds.objects.filter(user=request.user).count()
    ffu_count = FanFundingUpdate.objects.filter(user=request.user).count()
    if cred_count == 1 and ffu_count == 0:
        creds = AppCreds.objects.get(user=request.user)
        ffu = FanFundingUpdate(credentials=creds,
                               type="fanfunding",
                               user=request.user)
        ffu.save()
        return HttpResponseRedirect("/fanfunding/")

    CredsForm = creds_form(request.user)
    if request.POST:
        f = CredsForm(request.POST)
        if f.is_valid():
            creds = f.cleaned_data['account']
            ffu = FanFundingUpdate(credentials=creds,
                                   type="fanfunding",
                                   user=request.user)
            ffu.save()
            return HttpResponseRedirect("/fanfunding/")
    else:
        f = CredsForm()
    if cred_count == 0:
        return HttpResponseRedirect("/googleaccount/setup?redir=ffsetup")
    return render(request, "fanfunding/setup.html", {
        'form': f,
        'count': cred_count
    })
示例#2
0
def setup(request):
    CredsForm = creds_form(request.user)
    if request.POST:
        f = CredsForm(request.POST)
        if f.is_valid():
            creds = f.cleaned_data['account']
            ffu = SponsorUpdate(credentials=creds, type="sponsors", user=request.user)
            ffu.save()
            return HttpResponseRedirect("/sponsors/")
    else:
        f = CredsForm()
    return render(request, "sponsors/setup.html", {'form': f})
示例#3
0
def setup(request):
    CredsForm = creds_form(request.user)
    if request.POST:
        f = CredsForm(request.POST)
        if f.is_valid():
            creds = f.cleaned_data['account']
            ffu = SponsorUpdate(credentials=creds, last_update=datetime(1990,1,1,0,0,0), type="sponsors", user=request.user)
            ffu.save()
            return HttpResponseRedirect("/sponsors/")
    else:
        f = CredsForm()
    return render(request, "sponsors/setup.html", {'form': f})
示例#4
0
def setup(request):
    CredsForm = creds_form(request.user)
    if request.POST:
        f = CredsForm(request.POST)
        if f.is_valid():
            creds = f.cleaned_data['account']
            ffu = FanFundingUpdate(credentials=creds,
                                   type="fanfunding",
                                   user=request.user)
            ffu.save()
            return HttpResponseRedirect("/fanfunding/")
    else:
        f = CredsForm()
    return render(request, "fanfunding/setup.html", {'form': f})
示例#5
0
def setup(request):
    CredsForm = creds_form(request.user)

    if request.POST:
        f = CredsForm(request.POST)
        if f.is_valid():
            creds = f.cleaned_data['account']
            ffu = YoutubeSubUpdate(credentials=creds,
                                   type="youtubesubs",
                                   user=request.user)
            ffu.save()
            return HttpResponseRedirect("/youtubesubs/")
    else:
        f = CredsForm()
    return render(request, "youtubesubs/setup.html", {'form': f})
示例#6
0
文件: views.py 项目: google/mirandum
def setup(request):
    cred_count = AppCreds.objects.filter(user=request.user).count()
    ffu_count = YoutubeSubUpdate.objects.filter(user=request.user).count()
    if cred_count == 1 and ffu_count == 0:
        creds = AppCreds.objects.get(user=request.user)
        ffu = YoutubeSubUpdate(credentials=creds, type="youtubesubs", user=request.user)
        ffu.save()
        return HttpResponseRedirect("/youtubesubs/")
    CredsForm = creds_form(request.user)
    
    if request.POST:
        f = CredsForm(request.POST)
        if f.is_valid():
            creds = f.cleaned_data['account']
            ffu = YoutubeSubUpdate(credentials=creds, type="youtubesubs", user=request.user)
            ffu.save()
            return HttpResponseRedirect("/youtubesubs/")
    else:
        f = CredsForm()
    return render(request, "youtubesubs/setup.html", {'form': f})
示例#7
0
文件: views.py 项目: google/mirandum
def setup(request):
    cred_count = AppCreds.objects.filter(user=request.user).count()
    ffu_count = FanFundingUpdate.objects.filter(user=request.user).count()
    if cred_count == 1 and ffu_count == 0:
        creds = AppCreds.objects.get(user=request.user)
        ffu = FanFundingUpdate(credentials=creds, type="fanfunding", user=request.user)
        ffu.save()
        return HttpResponseRedirect("/fanfunding/")
        
    CredsForm = creds_form(request.user)
    if request.POST:
        f = CredsForm(request.POST)
        if f.is_valid():
            creds = f.cleaned_data['account']
            ffu = FanFundingUpdate(credentials=creds, type="fanfunding", user=request.user)
            ffu.save()
            return HttpResponseRedirect("/fanfunding/")
    else:
        f = CredsForm()
    if cred_count == 0:
        return HttpResponseRedirect("/googleaccount/setup?redir=ffsetup")
    return render(request, "fanfunding/setup.html", {'form': f, 'count': cred_count})
示例#8
0
def setup(request):
    cred_count = AppCreds.objects.filter(user=request.user).count()
    ffu_count = YoutubeSubUpdate.objects.filter(user=request.user).count()
    if cred_count == 1 and ffu_count == 0:
        creds = AppCreds.objects.get(user=request.user)
        ffu = YoutubeSubUpdate(credentials=creds,
                               type="youtubesubs",
                               user=request.user)
        ffu.save()
        return HttpResponseRedirect("/youtubesubs/")
    CredsForm = creds_form(request.user)

    if request.POST:
        f = CredsForm(request.POST)
        if f.is_valid():
            creds = f.cleaned_data['account']
            ffu = YoutubeSubUpdate(credentials=creds,
                                   type="youtubesubs",
                                   user=request.user)
            ffu.save()
            return HttpResponseRedirect("/youtubesubs/")
    else:
        f = CredsForm()
    return render(request, "youtubesubs/setup.html", {'form': f})