Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def add_a_doctor(request, id):
- polyclinic = Polyclinic.objects.get(id=id)
- login = request.POST.get('login')
- fio = request.POST.get('fio')
- specialty = request.POST.get('specialty')
- phone = request.POST.get('phone')
- drivers_license = request.POST.get('drivers_license')
- position = request.POST.get('position')
- password = generate_password()
- logging.info(' login : %s, fio : %s,specialty : %s, phone : %s, drivers_license : %s, position : %s ' % (login,fio,specialty, phone,drivers_license,position))
- try:
- account = User.objects.get(username = login)
- except Exception as e:
- account = User.objects.create(username = login, password = password)
- doctor = Doctor.objects.create(
- fio=fio,
- phone=phone,
- specialty=specialty,
- polyclinic = polyclinic,
- town = polyclinic.town,
- user = account,
- position = position,
- drivers_license = drivers_license,
- password = password
- )
- return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement