mirror of
https://github.com/lemeow125/Django-NotesApp.git
synced 2024-11-17 14:39:25 +08:00
15 lines
466 B
Python
15 lines
466 B
Python
from django.db import models
|
|
from django.utils.timezone import now
|
|
from django.contrib.auth import get_user_model
|
|
User = get_user_model()
|
|
# Create your models here.
|
|
|
|
|
|
class Note(models.Model):
|
|
title = models.CharField(max_length=20)
|
|
content = models.TextField()
|
|
date_created = models.DateTimeField(default=now, editable=False)
|
|
owner = models.ForeignKey(User, on_delete=models.CASCADE)
|
|
|
|
def __str__(self):
|
|
return self.title
|