Skip to content

Commit

Permalink
fix tetss
Browse files Browse the repository at this point in the history
  • Loading branch information
LegoStormtroopr committed Feb 29, 2016
1 parent 17d0b00 commit 8ea3d63
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions django_spaghetti/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class PoliceOfficer(models.Model):

arrests = models.ManyToManyField("Arrest",related_name="arresting_officers")


class PoliceStation(models.Model):
officers = models.ForeignKey("PoliceOfficer")


class Precinct(PoliceStation):
"""
A precinct of officers
Expand All @@ -20,27 +25,28 @@ class Precinct(PoliceStation):
number = models.IntegerField(primary_key=True)
burrough = models.CharField(max_length=20)
captain = models.OneToOneField(PoliceOfficer)
officers = models.ForeignKey("PoliceOfficer",related_name="precinct")

class Meta:
unique_together = ("burrough","number")
def natural_key(self):
return (self.burrough,self.number)


class Division(PoliceStation):
"""
A division of officers, not in the field.
E.g. Major Crimes Unit
"""
name = models.CharField(max_length=200)
officers = models.ForeignKey("PoliceOfficer",related_name="division")


class Arrest(models.Model):
alleged_crime = models.CharField(max_length=20)
perp = models.ForeignKey("Perpetrator")
arrest_date = models.DateField()
processing_date = models.DateField()


class Perpetrator(models.Model):
"""
A person who is accused of a crime.
Expand Down

0 comments on commit 8ea3d63

Please sign in to comment.