From 44f86a7d6fbce2bd9f446cba969d47daa6c74323 Mon Sep 17 00:00:00 2001 From: Martin Green <martin.speleo@gmail.com> Date: Sun, 10 Jul 2011 23:52:18 +0100 Subject: [PATCH] Added url to cave and turned entrances station names and removed the previous SurveyStation model. Note caves should be rendered in the directory of their original url to make links work. Note SurveyStations appeared to duplicate SurvexStations. Note Given we want to be running from a mercurial repository, it is easiest to store the names of survey stations rather than foreign keys. --- core/models.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/models.py b/core/models.py index f8e7400..1c08a25 100644 --- a/core/models.py +++ b/core/models.py @@ -368,6 +368,7 @@ class Cave(TroggleModel): extent = models.CharField(max_length=100,blank=True,null=True) survex_file = models.CharField(max_length=100,blank=True,null=True) description_file = models.CharField(max_length=200,blank=True,null=True) + url = models.CharField(max_length=200,blank=True,null=True) #class Meta: # unique_together = (("area", "kataster_number"), ("area", "unofficial_number")) @@ -466,11 +467,7 @@ class OtherCaveName(TroggleModel): cave = models.ForeignKey(Cave) def __unicode__(self): return unicode(self.name) - -class SurveyStation(TroggleModel): - name = models.CharField(max_length=200) - def __unicode__(self): - return unicode(self.name) + class Entrance(TroggleModel): slug = models.SlugField(max_length=50, unique = True) @@ -504,9 +501,9 @@ class Entrance(TroggleModel): alt = models.TextField(blank=True, null=True) northing = models.TextField(blank=True, null=True) easting = models.TextField(blank=True, null=True) - tag_station = models.ForeignKey(SurveyStation, blank=True,null=True, related_name="tag_station") - exact_station = models.ForeignKey(SurveyStation, blank=True,null=True, related_name="exact_station") - other_station = models.ForeignKey(SurveyStation, blank=True,null=True, related_name="other_station") + tag_station = models.TextField() + exact_station = models.TextField() + other_station = models.TextField() other_description = models.TextField(blank=True,null=True) bearings = models.TextField(blank=True,null=True) def __unicode__(self): @@ -623,7 +620,7 @@ class DPhoto(TroggleImageModel): is_mugshot = models.BooleanField(default=False) contains_cave = models.ForeignKey(Cave,blank=True,null=True) contains_entrance = models.ForeignKey(Entrance, related_name="photo_file",blank=True,null=True) - nearest_survey_point = models.ForeignKey(SurveyStation,blank=True,null=True) + #nearest_survey_point = models.ForeignKey(SurveyStation,blank=True,null=True) nearest_QM = models.ForeignKey(QM,blank=True,null=True) lon_utm = models.FloatField(blank=True,null=True) lat_utm = models.FloatField(blank=True,null=True)