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
|
2021-01-20 22:48:15 +00:00
|
|
|
|
|
|
|
def get_absolute_url(self):
|
|
|
|
return f"/{self.id}/"
|