Example #1
0
def sponsor_apply(request):
    if request.method == "POST":
        form = SponsorApplicationForm(request.POST, user=request.user)
        if form.is_valid():
            sponsor = form.save()
            return redirect("sponsor_detail", pk=sponsor.pk)
    else:
        form = SponsorApplicationForm(user=request.user)

    return render_to_response("sponsorship/apply.html", {"form": form}, context_instance=RequestContext(request))
Example #2
0
def sponsor_add(request):
    if not request.user.is_staff:
        raise Http404()

    if request.method == "POST":
        form = SponsorApplicationForm(request.POST, user=request.user)
        if form.is_valid():
            sponsor = form.save(commit=False)
            sponsor.active = True
            sponsor.save()
            return redirect("dashboard")
    else:
        form = SponsorApplicationForm(user=request.user)

    return render_to_response("sponsorship/add.html", {"form": form}, context_instance=RequestContext(request))
Example #3
0
def sponsor_add(request):
    if not request.user.is_staff:
        raise Http404()

    CHOICES = []
    for s in SponsorLevel.objects.all():
        CHOICES.append(( s, s.name + ': ' + ', '.join([b.benefit.name for b in BenefitLevel.objects.filter(level = s)]) ))

    if request.method == "POST":
        form = SponsorApplicationForm(request.POST, user=request.user, choices=CHOICES)

        if form.is_valid():
            sponsor = form.save(commit=False)
            sponsor.save()

            event_name = settings.EVENT_NAME
            event_website = settings.EVENT_WEBSITE
            event_email = settings.EVENT_EMAIL
            event_phone = settings.EVENT_PHONE

            message_ctx = {
                "sponsor": sponsor,
                "event_name": event_name,
                "event_website": event_website,
                "event_email": event_email,
                "event_phone": event_phone
            }

            for c in sponsor.sponsor_contacts:
                sponsor_email = c
                send_email(
                    [sponsor_email], "sponsor_signup_conf",
                    context = message_ctx
                )
            staff_members = User.objects.filter(is_staff=True)
            for staff in staff_members:
                staff_email = staff.email
                send_email(
                    [staff_email], "sponsor_signup",
                    context = message_ctx
                )
            return redirect("sponsor_detail", pk=sponsor.pk)
    else:
        form = SponsorApplicationForm(user=request.user, choices=CHOICES)

    return render_to_response("sponsorship/add.html", {
        "form": form,
    }, context_instance=RequestContext(request))
Example #4
0
def sponsor_apply(request):
    if request.method == "POST":
        form = SponsorApplicationForm(request.POST, user=request.user)
        if form.is_valid():
            sponsor = form.save()
            if sponsor.sponsor_benefits.all():
                # Redirect user to sponsor_detail to give extra information.
                messages.success(request, _("Thank you for your sponsorship "
                                            "application. Please update your "
                                            "benefit details below."))
                return redirect("sponsor_detail", pk=sponsor.pk)
            else:
                messages.success(request, _("Thank you for your sponsorship "
                                            "application."))
                return redirect("dashboard")
    else:
        form = SponsorApplicationForm(user=request.user)

    return render_to_response("symposion/sponsorship/apply.html", {
        "form": form,
    }, context_instance=RequestContext(request))
Example #5
0
def sponsor_apply(request):
    if request.method == "POST":
        form = SponsorApplicationForm(request.POST, user=request.user)
        if form.is_valid():
            sponsor = form.save()
            if sponsor.sponsor_benefits.all():
                # Redirect user to sponsor_detail to give extra information.
                messages.success(
                    request,
                    _("Thank you for your sponsorship "
                      "application. Please update your "
                      "benefit details below."))
                return redirect("sponsor_detail", pk=sponsor.pk)
            else:
                messages.success(
                    request, _("Thank you for your sponsorship "
                               "application."))
                return redirect("dashboard")
    else:
        form = SponsorApplicationForm(user=request.user)

    return render_to_response("symposion/sponsorship/apply.html", {
        "form": form,
    },
                              context_instance=RequestContext(request))
Example #6
0
def sponsor_apply(request):
    if request.method == "POST":
        form = SponsorApplicationForm(request.POST, user=request.user)
        if form.is_valid():
            sponsor = form.save()
            return redirect("sponsor_detail", pk=sponsor.pk)
    else:
        form = SponsorApplicationForm(user=request.user)
    
    return render_to_response("sponsorship/apply.html", {
        "form": form,
    }, context_instance=RequestContext(request))
Example #7
0
def sponsor_add(request):
    if not request.user.is_staff:
        raise Http404()
    
    if request.method == "POST":
        form = SponsorApplicationForm(request.POST, user=request.user)
        if form.is_valid():
            sponsor = form.save(commit=False)
            sponsor.active = True
            sponsor.save()
            return redirect("sponsor_detail", pk=sponsor.pk)
    else:
        form = SponsorApplicationForm(user=request.user)
    
    return render_to_response("sponsorship/add.html", {
        "form": form,
    }, context_instance=RequestContext(request))
Example #8
0
def sponsor_add(request):
    if not request.user.is_staff:
        raise Http404()

    if request.method == "POST":
        form = SponsorApplicationForm(request.POST, user=request.user)
        if form.is_valid():
            sponsor = form.save(commit=False)
            sponsor.active = True
            sponsor.save()
            return redirect("sponsor_detail", pk=sponsor.pk)
    else:
        form = SponsorApplicationForm(user=request.user)

    return render(
        request=request,
        template_name="symposion/sponsorship/add.html",
        context={"form": form},
    )
Example #9
0
def sponsor_apply(request):
    if request.method == "POST":
        form = SponsorApplicationForm(request.POST, user=request.user)
        if form.is_valid():
            sponsor = form.save()
            # Send email notification of successful application.
            for manager in settings.MANAGERS:
                send_email(
                    [manager[1]],
                    "sponsor_signup",
                    context={"sponsor": sponsor},
                )
            if sponsor.sponsor_benefits.all():
                # Redirect user to sponsor_detail to give extra information.
                messages.success(
                    request,
                    _("Thank you for your sponsorship "
                      "application. Please update your "
                      "benefit details below."),
                )
                return redirect("sponsor_detail", pk=sponsor.pk)
            else:
                messages.success(
                    request,
                    _("Thank you for your sponsorship "
                      "application."),
                )
                return redirect("dashboard")
    else:
        form = SponsorApplicationForm(user=request.user)

    return render(
        request=request,
        template_name="symposion/sponsorship/apply.html",
        context={"form": form},
    )