title: How do i do user = request.user in views.py just because i have foreign key in my model
body: <p>How do i update user field in views.py just because i have a view to edit and delete posts associated with the user. I also have a view that fetch products with user == request.user and show in the profile page. Almost my site is dependent on post creation.Please let me know how can I update that user foreign key while saving the form( ex:- product.user = request.user )</p>
  <p><em>My Models.py</em></p>
  <pre><code>```class Product(models.Model):
         user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
         title = models.CharField(max_length=150)
         details = models.TextField(default=&quot;...&quot;) ....```
  </code></pre>
  <p><em>My Forms.py</em></p>
  <pre><code>```class AddUserPacksForm(forms.ModelForm):
         user = forms.ModelChoiceField(label=&quot;&quot;,
                                    queryset=User.objects.all(),
                                    widget=forms.HiddenInput(), required=False)
         title = forms.CharField(label='Title', widget=forms.TextInput(
          attrs={'class': 'form-control'}))
         details = forms.CharField(label='Description', widget=forms.Textarea(
          attrs={'class': 'form-control'}))
         image = forms.FileField(label='Thumbnail', widget=forms.FileInput(
          attrs={'class': 'form-control'}))
         sp = forms.IntegerField(label='Selling Price', widget=forms.NumberInput(
          attrs={'class': 'form-control'}))
         dp = forms.IntegerField(label='Discounted Price', widget=forms.NumberInput(
          attrs={'class': 'form-control'}))
         buy_link = forms.CharField(
         label='Buy Link ( i.e Instagram Link, Shorten Urls, Your Own Website Link Where Users can Buy This Pack, etc )', widget=forms.TextInput(attrs={'class': 'form-control'}))
         category = forms.ChoiceField(label='Category', choices=CHOICES, widget=forms.Select(attrs={'class': 'form-control'}))
  
         class Meta:
             model = Product
             fields = ['title', 'details', 'image',
                    'sp', 'dp', 'buy_link', 'category']```
  </code></pre>
  <p><em>My Views.py</em></p>
  <pre><code>```def AddUserPacks(request):
         if request.method == &quot;POST&quot;:
             userform = AddUserPacksForm(request.POST, request.FILES)
             if userform.is_valid():
                 userpacks = userform.save(commit=False)
                 userform.user = request.user.get_profile()
                 userpacks.save()
                 messages.success(request, f'Successfully Uploaded the post')
                 return redirect('home')
             else:
                 messages.info(request,&quot;Something is wrong, Try Again&quot;)
         else:
             userform = AddUserPacksForm()
             return render(request, &quot;gfx/post/post.html&quot;, {'form': userform})```
  </code></pre>