Exemplo n.º 1
0
def digit_birhday(request, digit):
    digit = int(digit)
    if not ((digit > 0 and digit < 10) or digit in (11, 22)):
        raise Http404
    content = utils.api_request("sancta/article/chislo_rozhdeniya_{0}.json".format(digit))
    content = json.loads(content)
    return render_to_response(
        "numerology/num.html",
        {"url": "num_home", "num": digit, "article": content},
        context_instance=RequestContext(request),
    )
Exemplo n.º 2
0
def index(request):
    content = utils.api_request("sancta/article/{0}.json".format("chislo_rozhdeniya_raschet"))
    content = json.loads(content)

    if request.method == "POST":
        birthday_form = BirthdayForm(request.POST)
        if birthday_form.is_valid():
            result = get_birthday_num(birthday_form.cleaned_data["date"])
            return redirect("num_birthday", digit=result)
    else:
        birthday_form = BirthdayForm()

    return render_to_response(
        "numerology/index.html",
        {"url": "num_home", "form": birthday_form, "article": content},
        context_instance=RequestContext(request),
    )
Exemplo n.º 3
0
def index(request):

    content = utils.api_request("sancta/article/{0}.json".format("biorythms_about"))
    content = json.loads(content)

    if request.method == "POST":
        birthday_form = BirthdayForm(request.POST)
        if birthday_form.is_valid():
            birthday = datetime.strptime(birthday_form.cleaned_data["date"], "%d.%m.%Y").strftime("%Y-%m-%d")
            return redirect("bio_birthday", birthday=birthday)
    else:
        birthday_form = BirthdayForm()

    return render_to_response(
        "biorythms/index.html",
        {"url": "bio_home", "form": birthday_form, "content": content},
        context_instance=RequestContext(request),
    )