Created
September 11, 2019 22:09
-
-
Save silent1mezzo/c98c6a1eb04d8be1a38238b43c8fbaf0 to your computer and use it in GitHub Desktop.
Swear app models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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