Reputation: 75
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<form method="POST">
{% csrf_token %} {{ form.as_p }}
<input type="submit" value="Submit" />
</form>
</body>
</html>
class Post(CreateView):
fields = ("title","about","itempicture")
template_name = "post.html"
model = models.Listing
I can't seem to figure out why is is not working my html and views connect perfectly put when try to send in a post request it does not work I would happy if someone could help me out
Upvotes: 0
Views: 27
Reputation: 418
You should define your form in the view:
class Post(CreateView):
fields = ("title","about","itempicture")
template_name = "post.html"
model = models.Listing
form_class = YourForm
Upvotes: 1