Exemple #1
0
def community_job(request, slug):
    form = None
    if not UmmeliOpportunity.permitted.filter(slug=slug):
        messages.error(request, "Sorry, this post has been removed.")
        return redirect(reverse("community_jobs"))
    article = UmmeliOpportunity.permitted.get(slug=slug)

    if request.method == "POST":
        if request.POST.get("send_via") == "email":
            form = EmailCVForm(data=request.POST)
        else:
            form = FaxCVForm(data=request.POST)

        user_profile = request.user.get_profile()

        if form.is_valid() and not user_profile.missing_fields():
            send_via = form.cleaned_data["send_via"]
            send_to = form.cleaned_data["send_to"]

            if send_via == "email":
                user_profile.email_cv(send_to, article.description, job_date=article.created)
                msg = "You email has been sent."
                messages.success(request, msg)
                return redirect(reverse("community_jobs"))
            else:
                user_profile.fax_cv(send_to, article.description, job_date=article.created)
                msg = "You fax has been sent."
                messages.success(request, msg)
                return redirect(reverse("community_jobs"))

    return render(request, "opportunities/jobs/community_job.html", {"job": article, "form": form})
Exemple #2
0
def connection_job(request, user_id, pk):
    article = get_object_or_404(UmmeliOpportunity, pk=pk).to_view_model()

    if request.method == "POST":
        if request.POST.get("send_via") == "email":
            form = EmailCVForm(data=request.POST)
        else:
            form = FaxCVForm(data=request.POST)

        user_profile = request.user.get_profile()

        if form.is_valid() and not user_profile.missing_fields():
            send_via = form.cleaned_data["send_via"]
            send_to = form.cleaned_data["send_to"]

            if send_via == "email":
                user_profile.email_cv(send_to, article.text, job_date=article.created)
            else:
                user_profile.fax_cv(send_to, article.text, job_date=article.created)
            return redirect(reverse("connection_jobs", args=[user_id]))

    return redirect(reverse("my_connections"))
Exemple #3
0
def opportunity_apply(request, slug):
    form = None
    if not UmmeliOpportunity.permitted.filter(slug=slug):
        messages.error(request, 'Sorry, this post has been removed.')
        return redirect(reverse('opportunities'))
    opportunity = UmmeliOpportunity.permitted.get(slug=slug).as_leaf_class()

    if request.method == 'POST':
        if(request.POST.get('send_via') == 'email'):
            form = EmailCVForm(data=request.POST)
        else:
            form = FaxCVForm(data=request.POST)

        user_profile = request.user.get_profile()

        if form.is_valid() and not user_profile.missing_fields():
            send_via = form.cleaned_data['send_via']
            send_to = form.cleaned_data['send_to']

            if send_via == 'email':
                user_profile.email_cv(
                    send_to, opportunity.description,
                    job_date=opportunity.created)
                msg = 'You email has been sent.'
                messages.success(request, msg)
                return redirect(opportunity.get_absolute_url())
            else:
                user_profile.fax_cv(
                    send_to, opportunity.description,
                    job_date=opportunity.created)
                msg = 'You fax has been sent.'
                messages.success(request, msg)
                return redirect(opportunity.get_absolute_url())
        else:
            messages.error(request, 'Please enter a valid email')

    return redirect(opportunity.get_absolute_url())
Exemple #4
0
def send(request):
    form = None

    if request.method == "POST":
        if request.POST.get("send_via") == "email":
            form = EmailCVForm(data=request.POST)
        else:
            form = FaxCVForm(data=request.POST)

        user_profile = request.user.get_profile()

        if form.is_valid() and not user_profile.missing_fields():
            send_via = form.cleaned_data["send_via"]
            send_to = form.cleaned_data["send_to"]
            send_message = form.cleaned_data["send_message"]

            if send_via == "email":
                user_profile.email_cv(send_to, email_message=send_message)
                return send_thanks(request)
            else:
                user_profile.fax_cv(send_to, email_message=send_message)
                return send_thanks(request)

    return render(request, "send_cv.html", {"form": form})