Created
November 14, 2020 03:20
-
-
Save sankalpjonn/d5e29080d973326be371f0d03a5d23ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Note(models.Model): | |
# both these fields can be empty when you create a new note for the first time | |
title = models.CharField(max_length=255, null=True, blank=True) | |
content = models.TextField(null=True, blank=True) | |
# notes will be sorted using this field | |
last_udpated_on = models.DateTimeField(auto_now=True) | |
# to delete a note, we will simply set is_active to False | |
is_active = models.BooleanField(default=True) | |
def __str__(self): | |
return self.title |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment