Skip to content

Instantly share code, notes, and snippets.

@agusrichard
Created May 16, 2022 05:18
Show Gist options
  • Save agusrichard/a0f27471b94426df538cc8965ab5756a to your computer and use it in GitHub Desktop.
Save agusrichard/a0f27471b94426df538cc8965ab5756a to your computer and use it in GitHub Desktop.
from django.db import models
from django.contrib.auth.models import User
class Todo(models.Model):
title = models.CharField(max_length=100, null=False, blank=False, default=None)
description = models.TextField(null=False, blank=False, default=None)
completed = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(User, on_delete=models.CASCADE)
def __str__(self):
return str(self.title)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment