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,}))
|
return urljoin(settings.URL_ROOT, reverse('cave',kwargs={'cave_id':href,}))
|
||||||
|
|
||||||
def __str__(self, sep = ": "):
|
def __str__(self, sep = ": "):
|
||||||
return str("slug:"+self.slug())
|
return str("slug:"+str(self.slug()))
|
||||||
|
|
||||||
def get_QMs(self):
|
def get_QMs(self):
|
||||||
return QM.objects.filter(found_by__cave_slug=self.caveslug_set.all())
|
return QM.objects.filter(found_by__cave_slug=self.caveslug_set.all())
|
||||||
|
@ -72,16 +72,30 @@ def caveKey(x):
|
|||||||
"""
|
"""
|
||||||
return x.kataster_number
|
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):
|
def caveindex(request):
|
||||||
caves = Cave.objects.all()
|
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"))
|
caves1623 = list(Cave.objects.filter(area__short_name = "1623"))
|
||||||
caves1626 = list(Cave.objects.filter(area__short_name = "1626"))
|
caves1626 = list(Cave.objects.filter(area__short_name = "1626"))
|
||||||
#python2 to python3 issue https://realpython.com/python-sort/
|
#python2 to python3 issue https://realpython.com/python-sort/
|
||||||
caves1623.sort(key=caveKey)
|
caves1623.sort(key=caveKey)
|
||||||
caves1626.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=''):
|
def cave3d(request, cave_id=''):
|
||||||
cave = getCave(cave_id)
|
cave = getCave(cave_id)
|
||||||
|
@ -27,6 +27,14 @@ def flatpage(request, path):
|
|||||||
return troggle.core.views_caves.caveSlug(request, r.slug())
|
return troggle.core.views_caves.caveSlug(request, r.slug())
|
||||||
except Cave.DoesNotExist:
|
except Cave.DoesNotExist:
|
||||||
pass
|
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:
|
try:
|
||||||
r = EntranceRedirect.objects.get(originalURL = path)
|
r = EntranceRedirect.objects.get(originalURL = path)
|
||||||
|
Loading…
Reference in New Issue
Block a user