forked from expo/troggle
Much QM re-engineering
This commit is contained in:
@@ -144,38 +144,19 @@ class QM(TroggleModel):
|
||||
number = models.IntegerField(
|
||||
help_text="this is the sequential number in the year, only unique for CSV imports",
|
||||
)
|
||||
grade = models.CharField(max_length=1, blank=True, null=True, help_text="A/B/C/D/X")
|
||||
cave = models.ForeignKey("Cave", related_name="QMs", blank=True, null=True, on_delete=models.SET_NULL)
|
||||
block = models.ForeignKey("SurvexBlock", null=True, on_delete=models.SET_NULL) # only for QMs from survex files
|
||||
blockname = models.TextField(blank=True, null=True) # NB truncated copy of survexblock name with last char added
|
||||
expoyear = models.CharField(
|
||||
max_length=4, blank=True, null=True
|
||||
) # could change to datetime if logbooks similarly chnaged
|
||||
found_by = models.ForeignKey(
|
||||
LogbookEntry, related_name="QMs_found", blank=True, null=True, on_delete=models.SET_NULL
|
||||
)
|
||||
ticked = models.BooleanField(
|
||||
default=False
|
||||
) # for ticked QMs not attached to a logbook entry, should imply completion_description has text
|
||||
ticked_off_by = models.ForeignKey(
|
||||
LogbookEntry, related_name="QMs_ticked_off", blank=True, null=True, on_delete=models.SET_NULL
|
||||
) # unused, ever?!
|
||||
|
||||
GRADE_CHOICES = (
|
||||
("A", "A: Large obvious lead"),
|
||||
("B", "B: Average lead"),
|
||||
("C", "C: Tight unpromising lead"),
|
||||
("D", "D: Dig"),
|
||||
("X", "X: Unclimbable or horrid"),
|
||||
("V", "V: Vertical"),
|
||||
) # also seen "?" in imported data - see urls.py
|
||||
grade = models.CharField(max_length=1, choices=GRADE_CHOICES)
|
||||
expoyear = models.CharField(max_length=4, blank=True, null=True)
|
||||
ticked = models.BooleanField(default=False)
|
||||
location_description = models.TextField(blank=True)
|
||||
nearest_station_description = models.CharField(max_length=400, blank=True, null=True)
|
||||
completion_description = models.TextField(blank=True)
|
||||
completion_date = models.DateField(blank=True, null=True)
|
||||
nearest_station_name = models.CharField(max_length=200, blank=True, null=True)
|
||||
resolution_station_name = models.CharField(max_length=200, blank=True, null=True)
|
||||
nearest_station = models.ForeignKey("SurvexStation", blank=True, null=True, on_delete=models.SET_NULL)
|
||||
area = models.CharField(max_length=100, blank=True, null=True)
|
||||
completion_description = models.TextField(blank=True, null=True)
|
||||
page_ref = models.TextField(blank=True, null=True)
|
||||
comment = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
@@ -228,8 +209,8 @@ class QM(TroggleModel):
|
||||
),
|
||||
)
|
||||
|
||||
def get_next_by_id(self):
|
||||
def get_next_by_id(self): # called in template
|
||||
return QM.objects.get(id=self.id + 1)
|
||||
|
||||
def get_previous_by_id(self):
|
||||
def get_previous_by_id(self): # called in template
|
||||
return QM.objects.get(id=self.id - 1)
|
||||
|
||||
Reference in New Issue
Block a user