Skip to content

Instantly share code, notes, and snippets.

@silent1mezzo
Created September 11, 2019 22:09
Show Gist options
  • Save silent1mezzo/c98c6a1eb04d8be1a38238b43c8fbaf0 to your computer and use it in GitHub Desktop.
Save silent1mezzo/c98c6a1eb04d8be1a38238b43c8fbaf0 to your computer and use it in GitHub Desktop.
Swear app models.py
SWEAR_TYPES = (
(FUCK, 'Fuck'),
(BITCH, 'Bitch'),
(SHIT, 'Shit'),
(ASS, 'Ass'),
(OTHER, 'Other')
)
SWEAR_EVENT_TYPES = {
(0, 'G Stock'),
(1, 'Town Hall')
}
class SwearEvent(models.Model):
title = models.TextField(null=False)
stinger = models.TextField(null=True)
event_type = models.IntegerField(choices=SWEAR_EVENT_TYPES, default=0)
created = models.DateTimeField(auto_now_add=True)
class Swear(models.Model):
text = models.TextField(null=True)
event = models.ForeignKey(SwearEvent, related_name='swears', null=True)
updated = models.DateTimeField(auto_now=True)
created = models.DateTimeField(auto_now_add=True)
class Tag(models.Model):
swear = models.ForeignKey(Swear, related_name='tags')
swear_type = models.IntegerField(choices=SWEAR_TYPES)
created = models.DateTimeField(auto_now_add=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment