27 lines
767 B
Python
27 lines
767 B
Python
import datetime
|
|
|
|
from django.db import models
|
|
from django.contrib.auth import models as auth_models
|
|
|
|
|
|
class Person(models.Model):
|
|
name = models.CharField(null=False, unique=True, blank=False, max_length=120)
|
|
user = models.ForeignKey(
|
|
auth_models.User, null=True, default=None, on_delete=models.SET_NULL
|
|
)
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
class Meta:
|
|
verbose_name_plural = "people"
|
|
|
|
|
|
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)
|
|
references = models.ManyToManyField(Person)
|
|
|
|
def __str__(self):
|
|
return self.quote
|