def card_data(step, name, contact): """ Creates card data with that contact. """ contact_object = ContactInformation.objects.filter(name=contact)[0] card_data = CardData(name=name, id_number=1, picture="", contact=contact_object, passphrase=PASSPHRASE) card_data.save()
def add_entry(step, card, contact_name): """ Adds entry with contact """ contact = ContactInformation(email="", name=contact_name, phone_number=0, facebook_url="") contact.save() contact_object = ContactInformation.objects.filter(name=contact_name)[0] card_data = CardData(name=card, id_number=1, picture="", contact=contact_object, passphrase=PASSPHRASE) card_data.save()
def submit(request): """ Submits a POST request for the form submission. """ try: contact_name = request.POST["contact_name"] email = request.POST["email"] phone = request.POST["phone"] facebook = request.POST["url"] contact = ContactInformation(email=email, name=contact_name, phone_number=phone, facebook_url=facebook) contact.save() name = request.POST["name"] id_number = request.POST["id_number"] picture = "" passphrase = request.POST["password"] card = CardData(name=name, id_number=id_number, picture=picture, contact=contact, passphrase=passphrase) card.save() return HttpResponseRedirect(reverse("app:success")) except (ValueError): return HttpResponseRedirect(reverse("app:fail"))