Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Encounter(models.Model):
- subject = models.ForeignKey('Subject', to_field='uuid')
- uuid = models.SlugField(max_length=36, unique=True, default=make_uuid, editable=False)
- class Subject(models.Model):
- uuid = models.SlugField(max_length=36, unique=True, default=make_uuid, editable=False)
- location = models.ForeignKey('Location', blank=True, to_field='uuid')
- class Location(models.Model):
- uuid = models.SlugField(max_length=36, unique=True, default=make_uuid, editable=False)
- Location.objects.annotate(encounter_count=Count('subject__encounter'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement