title: How to fetch the selected dropdown values in the editable form in the dropdown using django
body: <p>Dropdown value is stored in separate table,how to retrieve the dropdown value in the editable form</p>
  
  <p>views.py</p>
  
  <pre><code>def edit(request, id):
          form = DeptForm(request.POST)
          form1 = DesigForm(request.POST)
          dt = Department.objects.all()
          dg = Designation.objects.all()
  dept = request.POST.get("depart")
  
          Department.id = dt
          desig = request.POST.get("design")
  
          Designation.id = dg
          print(Designation)
          edit_record = Emp_Profile.objects.get(pk=id)
          print(edit_record)
          context = {
                  'edit_record': edit_record
         }
          print(context)
          print(edit_record.department)
          return render(request, 'registration/register_edit.html', context,{'form' : form, 'form1' : form1})
  
  def update(request, id):
          form = DeptForm(request.POST)
          form1 = DesigForm(request.POST)
          dt = Department.objects.all()
          dg = Designation.objects.all()
  
  
          if request.method == "POST":
  
                  First_name = request.POST['First_name']
                  lname = request.POST['lname']
                  depart = request.POST.get("depart")
                  Department.id = dt
  
                  print(depart)
                  uname = request.POST['uname']
                  design = request.POST.get("design")
                  Designation.id = dg
                  print("design")
                  print(design)
                  mnumber = request.POST['mnumber']
  
                  Emp_Profile.objects.filter(pk=id).update(
                          first_name=First_name,
                          last_name=lname,
                          Mobile_Number=mnumber,
                          username=uname,
  
                  )
  
                  return redirect('/accounts/profile/')
          return render(request,'register_edit.html',{'form':form, 'form1':form1})
  </code></pre>
  
  <p>In this department and designation is two separate table,while storing it is stored in another table called "Emp_Profile".while editing,the selected value of department and designation should come with dropdown.</p>