Created
March 12, 2015 17:13
-
-
Save Resisty/52ab60a592ed72e18b16 to your computer and use it in GitHub Desktop.
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
class BaseModel(Model): | |
class Meta: | |
database = psql_db | |
# There can be a lot of Alerts that come in. | |
# Each Alert can "have" many users | |
class Alert(BaseModel): | |
alertId = CharField(unique = True, primary_key = True) | |
alertLink = Charfield(unique = True) | |
startTime = TimeField() | |
endTime = TimeField(null = True) | |
alertType = CharField(null = True) | |
jcaLink = CharField() | |
links = CharField(null = True) | |
event = ForeignKeyField(Event, related_name = 'alerts') | |
class Meta: | |
order_by = ('eventId',) | |
# Basic Person/User | |
class Person(BaseModel): | |
name = CharField(unique = True,) | |
link = CharField(unique = True) | |
# Associates Person with Alert, I guess? | |
class PersonAlertAssoc(BaseModel): | |
person = ForeignKey(Person, related_name = 'person') | |
alert = ForeignKey(Alert, related_name = 'alert') | |
# Each Event can "have" many Alerts and a description/assessment | |
class Event(BaseModel): | |
assessment = CharField() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment