QM report updating

This commit is contained in:
Philip Sargent 2023-03-14 16:11:37 +00:00
parent 934a19b879
commit a7660c8ec7
2 changed files with 10 additions and 7 deletions

View File

@ -137,6 +137,8 @@ class PersonLogEntry(TroggleModel):
class QM(TroggleModel): class QM(TroggleModel):
"""This is based on qm.csv in trunk/expoweb/1623/204 which has the fields: """This is based on qm.csv in trunk/expoweb/1623/204 which has the fields:
"Number","Grade","Area","Description","Page reference","Nearest station","Completion description","Comment" "Number","Grade","Area","Description","Page reference","Nearest station","Completion description","Comment"
All the stuff handling TICK QMs is INCOMPLETE
""" """
cave = models.ForeignKey("Cave", related_name="QMs", blank=True, null=True, on_delete=models.SET_NULL) cave = models.ForeignKey("Cave", related_name="QMs", blank=True, null=True, on_delete=models.SET_NULL)
@ -193,7 +195,8 @@ class QM(TroggleModel):
return f"{cavestr}-{expoyearstr}-{self.number}{self.grade}{blocknamestr}" return f"{cavestr}-{expoyearstr}-{self.number}{self.grade}{blocknamestr}"
def get_completion_url(self): def get_completion_url(self):
"""assumes html file named is in same folder as cave description file""" """assumes html file named is in same folder as cave description file
WRONG - needs rewriting!"""
cd = None cd = None
if self.completion_description: if self.completion_description:
try: try:
@ -223,8 +226,8 @@ class QM(TroggleModel):
), ),
) )
def get_next_by_id(self): # def get_next_by_id(self):
return QM.objects.get(id=self.id + 1) # return QM.objects.get(id=self.id + 1)
def get_previous_by_id(self): # def get_previous_by_id(self):
return QM.objects.get(id=self.id - 1) # return QM.objects.get(id=self.id - 1)

View File

@ -70,9 +70,9 @@ Found by <a href="{{qm.found_by.get_absolute_url}}">{{qm.found_by}}</a> on {{qm.
<h3>Completion</h3> <h3>Completion</h3>
{% if qm.ticked %} {% if qm.ticked %}
Ticked off log entry: <a href="{{qm.ticked_off_by.get_absolute_url}}">{{qm.ticked_off_by}}</a><br /> Ticked off log entry: <a href="{{qm.ticked_off_by.get_absolute_url}}">{{qm.ticked_off_by}}</a><br />
Ticked off Description Page: <a href="/{{qm.get_completion_url}}">{{qm.get_completion_url}}</a> <br /> Ticked off date: <a href="/{{qm.get_completion_url}}">{{qm.get_completion_url}}</a> WRONG <br />
Tick off date: [For survex file ticks. not implemented yet, needs model change]</a> <br /> Tick off date: [For survex file ticks. not implemented yet, needs model change]</a> <br />
Tick off comment: [For survex file ticks. not implemented yet, needs model change]</a> Tick off completion description: {{qm.completion_description}}</a>
{% else %} {% else %}
No completion description yet- STILL EXTANT. No completion description yet- STILL EXTANT.