[FIXED] Override the template of a widget and pass values to it with Django 4.0


I’m creating a simple app for doing product reviews.
I have a Product, Manufacturer and Review model, which I put together

class Manufacturer (models.Model):
    Name = models.CharField()

Class Products (models.Model):
    Name = models.CharField()

Class review (models.Model):
    Title = CharField()
    product = models.ForeignKey(product)

I created a ModelForm to create a review.
So far you’ve only been able to create custom widgets using overridden templates.

class CustomSelectWidget(forms.widgets.Select):
    option_template_name = 'widgets/select_option.html'

Class NewReviewForm(forms.ModelForm):
    review = Form.ModelMultipleChoiceField(
        queryset = Review.objects.none(),
        Widget = CustomSelectWidget(),
    class meta:
        model = review
        field = '__all__'

Form views are regular function-based views.
The review field is rendered with the list of products inside the

(*) Required, Your email will not be published