Hello i have been working on django CreateVeiw. As i have add tags and save my post form. But the problem is after i click submit it just reload the page and when i check on my post it didnt add also. Did i miss something out? Can someone answer me? This is my view of creating post.
class PostCreate(CreateView):
template_name = 'add_post.html'
model = Post
form_class = PostForm
def form_valid(self, form):
form.instance.user = self.request.user
form = form.save(commit=False)
form.slug = slugify(form.title)
form.save()
form.save_m2m()
return super(PostCreate, self).form_valid(form)
def get_success_url(self):
return reverse('article-list', args=self.object.id,)
Thanks in advance :).
Have you tried: