Answer the question
In order to leave comments, you need to log in
How can I make it so that the user can add posts through a form on the site, and not through the Django admin panel?
How can I make it so that the user can add posts through a form on the site, and not through the Django admin panel?
there is this model:
class Product(ModelForm):
title = models.CharField(max_length = 130)
slug = models.SlugField()
description = models.TextField()
prise = models.DecimalField(max_digits = 7, decimal_places=0)
available = models.BooleanField(default=True)
def __str__(self):
return self.title
class ProductForm(ModelForm):
class Meta:
model = Product
fields = ['description', 'prise', 'available', 'title', 'slug']
class ProductForm(UpdateView): # CreateView ...
template_name = 'index.html'
form_class = ProductForm
model = Product
success_url = "/"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question