title: Django Error: Cannot resolve keyword 'user' into field. choices are
body: <p><strong>I am trying to edit data of model UserProfile.
  Here is code for same.</strong></p>
  
  <h1>form.py</h1>
  
  <pre><code>class UserprofileForm(forms.ModelForm):
      class Meta:
          model = UserProfile
          fields = ['profile_photo', 'gender', 'contact_number', 'age', 'address']
  </code></pre>
  
  <h1>view.py</h1>
  
  <pre><code>def edit_user(request):
      if not request.user.is_authenticated():
          return render(request, 'service/login.html')
      else:
          userdata = UserProfile.objects.all().filter(user = request.user)
          userd = UserProfile.objects.get(user2 = request.user.pk)
          form = UserprofileForm(request.POST or None, instance = user2)
          if form.is_valid():
              user1 = form.save(commit = False)
              user1.user = request.user
              user1.save()
              return render(request,'service/user.html', {'userdata' : userdata,})
  </code></pre>