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}/"