demo-backend/todos/models.py

13 lines
365 B
Python
Raw Permalink Normal View History

2025-01-16 14:20:20 +01:00
from django.db import models
from django.contrib.auth.models import User
class Todo(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
title = models.CharField(max_length=200)
completed = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title