Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @login_required
- def profile1(request):
- data = {
- 'abonent_profile': ProfileAbonent(),
- }
- if request.method =="POST":
- if abonent_profile.is_valid():
- abonent_profile = ProfileAbonent(request.POST, request.FILES, instance=request.user.profile)
- with connections['api_db'].cursor() as cursor:
- abonentname = abonent_profile.cleaned_data['abonentname']
- department_name = abonent_profile.cleaned_data['department']
- lsch = abonent_profile.cleaned_data['lsch']
- department_id = Department.objects.get(name=department_name)
- cursor.execute("EXEC FindPobutAbonent @DepartmentId={} , @Abonentname={} , @lsch={}".format(department_id, abonentname, lsch));
- data["abonents"] = dictfetchall(cursor)
- else:
- abonent_profile = ProfileAbonent()
- return render(request, 'users/profile1.html', data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement