in post model add a boolean field ( approved : default = false ) ..
and in your views filter only approved posts before showing them ...
this way admin can login to admin panel , check the latest posts and approve them ( make approve = True ) then and only then they will be viewed in your templates
On Wed, Apr 22, 2020 at 3:04 AM Ahmed Khairy <ahmed.heshameldin@gmail.com> wrote:
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 = Postfields = ['title', 'content']template_name = "post_form.html"def form_valid(self, form):form.instance.author = self.request.userreturn 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+unsubscribe@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.
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHV4E-f-Vw%3D9qkqBz7oXAjVo%2Bz6YTg649vP%2B2MLBmo9iryJ_fw%40mail.gmail.com.
No comments:
Post a Comment