I'm trying to apply an activate/deactivate feature for my posts on a blog app. Here is my model. My desire is to be able to activate the post to show it in a template but how can I change (set) the value of is_activate
field through the view.py? Here is my model:
class Post(models.Model):
title = models.CharField(max_length=250)
slug = models.SlugField(max_length=250)
body = models.TextField()
is_activate = models.BooleanField(default=False)
Summarizing: I need a button which on clicking activates a post and then show it in a template with other activated posts.