Set backref labels

Fixes #6
This commit is contained in:
Matthew Ryan Dillon 2016-06-15 10:43:02 -07:00
parent dbfe88610a
commit 70046b5104
14 changed files with 357 additions and 40 deletions

View file

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('locations', '0004_DATA_initial'),
]
operations = [
migrations.AlterField(
model_name='site',
name='region',
field=models.ForeignKey(blank=True, related_name='sites', null=True, to='locations.Region'),
),
migrations.AlterField(
model_name='studylocation',
name='municipal_location',
field=models.ForeignKey(blank=True, related_name='study_locations', null=True, to='locations.MunicipalLocation'),
),
migrations.AlterField(
model_name='studylocation',
name='site',
field=models.ForeignKey(related_name='study_locations', to='locations.Site'),
),
]

View file

@ -18,7 +18,7 @@ class Region(models.Model):
class Site(models.Model):
region = models.ForeignKey(Region, blank=True, null=True)
region = models.ForeignKey(Region, blank=True, null=True, related_name='sites')
name = models.CharField(max_length=100)
code = models.CharField(max_length=10, blank=True)
description = models.CharField(max_length=255, blank=True)
@ -48,13 +48,13 @@ class MunicipalLocation(models.Model):
class StudyLocation(models.Model):
site = models.ForeignKey(Site)
site = models.ForeignKey(Site, related_name='study_locations')
name = models.CharField(max_length=100)
code = models.CharField(max_length=10)
study_location_type = models.CharField(max_length=50, blank=True)
treatment_type = models.CharField(max_length=100, blank=True)
municipal_location = models.ForeignKey(MunicipalLocation,
blank=True, null=True)
blank=True, null=True, related_name='study_locations')
collecting_location = models.BooleanField(default=False)
description = models.CharField(max_length=255, blank=True)
sort_order = models.IntegerField(blank=True, null=True)