2019-04-12 21:15:18 +08:00
|
|
|
from django.db import models
|
2022-11-04 03:11:19 +08:00
|
|
|
from django.utils import timezone
|
|
|
|
|
|
|
|
|
|
|
|
class RelatedModel(models.Model):
|
|
|
|
simple = models.ForeignKey("SimpleModel", models.CASCADE, null=True)
|
2019-04-12 21:15:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
class SimpleModel(models.Model):
|
|
|
|
field = models.IntegerField()
|
2022-11-04 03:11:19 +08:00
|
|
|
created = models.DateTimeField(default=timezone.now)
|
2022-11-04 22:22:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
class ManyToManyModel(models.Model):
|
|
|
|
simples = models.ManyToManyField("SimpleModel")
|