title: Django Forms Customization
body: <p>I have a page that displays products that have been ordered and I want to give the user the ability to leave a review on their products which have been ordered. I have a review model as well, but when rendering the form it will list all of the products available on the website when I want only the products the customer has ordered to display. Is this possible? I am unsure how to accomplish this with django.</p>
  <p>edit: if it makes more sense due to my bad explanation, I want the select options to be limited to only what the user has ordered</p>
  <p>This is the form</p>
  <pre><code>class ReviewForm(forms.ModelForm):
      class Meta:
          model = Review
          exclude = ['user', 'date']
          widgets = {
              'product': forms.Select(attrs={
                  'class': 'form-control'
              }),
              'rating': forms.NumberInput(attrs={
                  'class': 'form-control',
                  'placeholder': '5.0..'
              }),
              'comment': forms.Textarea(attrs={
                  'class': 'form-control'
              })
          }
  </code></pre>
  <p>This is the view with the get request only</p>
  <pre><code>class MyOrdersView(LoginRequiredMixin, View):
      def get(self, request, *args, **kwargs):
          try:
              order = ShoppingCartOrder.objects.filter(user=self.request.user, ordered=True)
              form = ReviewForm()
              context = {
                  'object': order,
                  'form': form
              }
              return render(request, 'my_site/my_orders.html', context)
          except ObjectDoesNotExist:
              messages.warning(request, 'You do not have any orders')
              return redirect('all_products')
  </code></pre>
  <p>And if needed this is how I am displaying the form on the page</p>
  <pre><code>    &lt;div class=&quot;container w-25 mb-5&quot;&gt;
          &lt;form&gt;
              {% csrf_token %}
              {% for field in form %}
              &lt;div class=&quot;form-group px-3 my-3&quot;&gt;
              {{ field.label_tag }}
              {{ field }}
              {{ field.help_text }}
              {{ field.errors }}
              &lt;/div&gt;
              {% endfor %}
            &lt;/form&gt;
      &lt;/div&gt;
  </code></pre>
  <p>this is the review model</p>
  <pre><code>class Review(models.Model):
      user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
      product = models.ForeignKey(Product, on_delete=models.SET_NULL, null=True)
      rating = models.DecimalField(max_digits=2, decimal_places=1, validators=[MinValueValidator(Decimal('0.1'))])
      comment = models.TextField(validators=[MinLengthValidator(10)])
      date = models.DateField(auto_now=True)
  
      def __str__(self):
          return str(self.user) 
  </code></pre>