I am trying to populate a database, but when I send it it gives me the following error didn't return an HttpResponse
this is the form class ProductForm(forms.ModelForm): name_product = forms.CharField( max_length=25, widget=forms.TextInput( attrs={ 'class': 'form-control', 'id': 'name_product', } ) ) def clean_name_product(self): name_product = self.cleaned_data.get('name_product') if Product.objects.filter(name_product=name_product).exists(): raise forms.ValidationError('El nombre del producto ya existe') return name_product class Meta: model = Product fields = ( 'name_product', 'description', 'price', 'category', 'state', 'image' ) labels = { 'name_product': 'Nombre del Producto', 'description': 'Descripcion', 'price': 'Precio', 'category': 'Categoria', 'state': 'Estado', 'image': 'Imagen del Producto', } widgets = { 'name_product': forms.TextInput( attrs={ 'class': 'form-control', 'id': 'name_product', } ), 'description': forms.TextInput( attrs={ 'class': 'form-control', 'id': 'description', } ), 'price': forms.NumberInput( attrs={ 'class': 'form-control', 'id': 'price', } ), 'category': forms.SelectMultiple( attrs={ 'class': 'custom-select', 'id': 'category', } ), 'state': forms.CheckboxInput(), } and this is the model class Product(models.Model): name_product = models.CharField(max_length=25) description = models.CharField(max_length=250) price = models.IntegerField() category = models.ForeignKey(Category, on_delete=models.CASCADE) state = models.BooleanField(default=True) image = models.ImageField(upload_to='products/') created_at = models.DateField(auto_now=True) def __str__(self): return self.name_product this is the view class ProductView(View): template_name = 'products/product.html' model = Product form_class = ProductForm def get_queryset(self): return self.model.objects.filter(state=True) def get_context_data(self, **kwargs): context = {} context['product'] = self.get_queryset() context['list_product'] = self.form_class return context def get(self, request, *args, **kwargs): return render(request, self.template_name, self.get_context_data()) def post(self, request, *args, **kwargs): list_product = self.form_class(request.POST) if list_product.is_valid(): list_product.save() return redirect('products:product') the error is. The views products.views.ProductView didn't return an httpresponse object. it returned none instead -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/211be261-f187-4ac4-a374-261480dd2696%40googlegroups.com.