mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
Fix bad pages for clashing kataster numbers
This commit is contained in:
parent
72fd57ef76
commit
75bac01f3a
@ -125,7 +125,7 @@ class Cave(TroggleModel):
|
||||
return urljoin(settings.URL_ROOT, reverse('cave',kwargs={'cave_id':href,}))
|
||||
|
||||
def __str__(self, sep = ": "):
|
||||
return str("slug:"+self.slug())
|
||||
return str("slug:"+str(self.slug()))
|
||||
|
||||
def get_QMs(self):
|
||||
return QM.objects.filter(found_by__cave_slug=self.caveslug_set.all())
|
||||
|
@ -72,16 +72,30 @@ def caveKey(x):
|
||||
"""
|
||||
return x.kataster_number
|
||||
|
||||
def getnotablecaves():
|
||||
notablecaves = []
|
||||
for kataster_number in settings.NOTABLECAVESHREFS:
|
||||
try:
|
||||
cave = Cave.objects.get(kataster_number=kataster_number)
|
||||
notablecaves.append(cave)
|
||||
except:
|
||||
print(" ! FAILED to get only one cave per kataster_number for: "+kataster_number)
|
||||
caves = Cave.objects.all().filter(kataster_number=kataster_number)
|
||||
for c in caves:
|
||||
print(c.kataster_number, c.slug())
|
||||
if c.slug() != None:
|
||||
notablecaves.append(c)
|
||||
return notablecaves
|
||||
|
||||
|
||||
def caveindex(request):
|
||||
caves = Cave.objects.all()
|
||||
notablecavehrefs = settings.NOTABLECAVESHREFS
|
||||
notablecaves = [Cave.objects.get(kataster_number=kataster_number) for kataster_number in notablecavehrefs ]
|
||||
caves1623 = list(Cave.objects.filter(area__short_name = "1623"))
|
||||
caves1626 = list(Cave.objects.filter(area__short_name = "1626"))
|
||||
#python2 to python3 issue https://realpython.com/python-sort/
|
||||
caves1623.sort(key=caveKey)
|
||||
caves1626.sort(key=caveKey)
|
||||
return render(request,'caveindex.html', {'caves1623': caves1623, 'caves1626': caves1626, 'notablecaves':notablecaves, 'cavepage': True})
|
||||
return render(request,'caveindex.html', {'caves1623': caves1623, 'caves1626': caves1626, 'notablecaves':getnotablecaves(), 'cavepage': True})
|
||||
|
||||
def cave3d(request, cave_id=''):
|
||||
cave = getCave(cave_id)
|
||||
|
@ -27,6 +27,14 @@ def flatpage(request, path):
|
||||
return troggle.core.views_caves.caveSlug(request, r.slug())
|
||||
except Cave.DoesNotExist:
|
||||
pass
|
||||
except:
|
||||
print(" ! FAILED to get only one cave per slug for: "+path)
|
||||
caves = Cave.objects.all().filter(url = path)
|
||||
for c in caves:
|
||||
print(path, c.slug())
|
||||
if c.slug() != None:
|
||||
return troggle.core.views_caves.caveSlug(request, c.slug())
|
||||
pass
|
||||
|
||||
try:
|
||||
r = EntranceRedirect.objects.get(originalURL = path)
|
||||
|
Loading…
Reference in New Issue
Block a user