Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. @login_required
  2. def profile1(request):
  3. data = {
  4. 'abonent_profile': ProfileAbonent(),
  5. }
  6. if request.method =="POST":
  7. if abonent_profile.is_valid():
  8. abonent_profile = ProfileAbonent(request.POST, request.FILES, instance=request.user.profile)
  9. with connections['api_db'].cursor() as cursor:
  10. abonentname = abonent_profile.cleaned_data['abonentname']
  11. department_name = abonent_profile.cleaned_data['department']
  12. lsch = abonent_profile.cleaned_data['lsch']
  13. department_id = Department.objects.get(name=department_name)
  14. cursor.execute("EXEC FindPobutAbonent @DepartmentId={} , @Abonentname={} , @lsch={}".format(department_id, abonentname, lsch));
  15. data["abonents"] = dictfetchall(cursor)
  16. else:
  17. abonent_profile = ProfileAbonent()
  18. return render(request, 'users/profile1.html', data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement