Skip to content

Instantly share code, notes, and snippets.

@wselfjes
Created August 20, 2021 09:02
Show Gist options
  • Save wselfjes/605678f746bdfdb5c9f1ba53aca8d687 to your computer and use it in GitHub Desktop.
Save wselfjes/605678f746bdfdb5c9f1ba53aca8d687 to your computer and use it in GitHub Desktop.
Anna's models design
from django.db import models
class NameDescription:
name = models.CharField(max_length=30)
description = models.TextField(blank=True)
class ToAll:
characters = models.ManyToManyField('lore.Character')
events = models.ManyToManyField('lore.Event')
factions = models.ManyToManyField('lore.Faction')
items = models.ManyToManyField('lore.Item')
places = models.ManyToManyField('lore.Place')
class Item(models.Model, NameDescription, ToAll):
pass
class Character(models.Model, NameDescription, ToAll):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment