0

This is my first Django application.

I am making a blog and I want to categorize the posts according to their category(World, Tech, Tutorial, etc.). So I am using multiple boolean fields for a user to check according to the post type. But I want other values to turn False if one is checked(turned True)

Please help me

#models.py

from django.db import models
from django.utils.timezone import datetime
# Create your models here.
class Post(models.Model):
    """docstring for Post"""
    title = models.CharField(max_length=200)
    text = models.TextField()
    work = models.BooleanField(initial = False)
    technology = models.BooleanField(initial = False)
    how = models.BooleanField(initial = False)
    review = models.BooleanField(initial = False)
    tutorial = models.BooleanField(initial = False)
    created_on = models.DateTimeField(auto_now_add = True)
    updated_on = models.DateTimeField(auto_now = True)

    def __str__(self):
        return self.title

0 Answers0