Hi all, 

I have made a blog as a project and I have set users to submit posts for 
the blog directly but i want to direct this post to the admin first for 
approval before showing on the website. here is the Post Create View Class. 

class PostCreateView(CreateView):
    model = Post
    fields = ['title', 'content']
    template_name = "post_form.html"

    def form_valid(self, form):
        form.instance.author = self.request.user
        return super().form_valid(form)

Thank you in Advance 

-- 
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/95facfb3-dedb-476d-957f-80ef2eb72e44%40googlegroups.com.

Reply via email to