from django.contrib.auth import get_user_model from django.db import models from django.db.models import CASCADE User = get_user_model() class Story(models.Model): name = models.CharField(max_length=256, null=True, blank=True) created = models.DateTimeField() class StoryPart(models.Model): user = models.ForeignKey(User, on_delete=CASCADE) text = models.TextField() part_of = models.ForeignKey('Story', on_delete=CASCADE)