depot/web/quotes/quotedb/models.py

17 lines
452 B
Python
Raw Normal View History

2021-01-19 03:51:22 +00:00
import datetime
from django.db import models
from django.contrib.auth import models as auth_models
class Quote(models.Model):
quote = models.TextField(null=False, blank=False)
added_by = models.ForeignKey(auth_models.User, on_delete=models.SET_NULL, null=True)
added_at = models.DateTimeField(default=datetime.datetime.now)
def __str__(self):
return self.quote
def get_absolute_url(self):
return f"/{self.id}/"