mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
Moved notable caves to settings.py, link to a script to fix permissions
This commit is contained in:
parent
4771f52b20
commit
7aed3d3b30
@ -1,4 +1,5 @@
|
||||
import urllib, urlparse, string, os, datetime, logging, re
|
||||
import subprocess
|
||||
from django.forms import ModelForm
|
||||
from django.db import models
|
||||
from django.contrib import admin
|
||||
@ -33,7 +34,13 @@ def get_related_by_wikilinks(wiki_text):
|
||||
|
||||
return res
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG,
|
||||
try:
|
||||
logging.basicConfig(level=logging.DEBUG,
|
||||
filename=settings.LOGFILE,
|
||||
filemode='w')
|
||||
except:
|
||||
subprocess.call(settings.FIX_PERMISSIONS)
|
||||
logging.basicConfig(level=logging.DEBUG,
|
||||
filename=settings.LOGFILE,
|
||||
filemode='w')
|
||||
|
||||
@ -447,7 +454,7 @@ class Cave(TroggleModel):
|
||||
return unicode(self.slug())
|
||||
|
||||
def get_QMs(self):
|
||||
return QM.objects.filter(found_by__cave=self)
|
||||
return QM.objects.filter(found_by__cave_slug=self.caveslug_set.all())
|
||||
|
||||
def new_QM_number(self, year=datetime.date.today().year):
|
||||
"""Given a cave and the current year, returns the next QM number."""
|
||||
@ -497,7 +504,11 @@ class Cave(TroggleModel):
|
||||
return res
|
||||
|
||||
def writeDataFile(self):
|
||||
f = open(os.path.join(settings.CAVEDESCRIPTIONS, self.filename), "w")
|
||||
try:
|
||||
f = open(os.path.join(settings.CAVEDESCRIPTIONS, self.filename), "w")
|
||||
except:
|
||||
subprocess.call(settings.FIX_PERMISSIONS)
|
||||
f = open(os.path.join(settings.CAVEDESCRIPTIONS, self.filename), "w")
|
||||
t = loader.get_template('dataformat/cave.xml')
|
||||
c = Context({'cave': self})
|
||||
u = t.render(c)
|
||||
@ -673,7 +684,11 @@ class Entrance(TroggleModel):
|
||||
return self.cached_primary_slug
|
||||
|
||||
def writeDataFile(self):
|
||||
f = open(os.path.join(settings.ENTRANCEDESCRIPTIONS, self.filename), "w")
|
||||
try:
|
||||
f = open(os.path.join(settings.ENTRANCEDESCRIPTIONS, self.filename), "w")
|
||||
except:
|
||||
subprocess.call(settings.FIX_PERMISSIONS)
|
||||
f = open(os.path.join(settings.ENTRANCEDESCRIPTIONS, self.filename), "w")
|
||||
t = loader.get_template('dataformat/entrance.xml')
|
||||
c = Context({'entrance': self})
|
||||
u = t.render(c)
|
||||
|
@ -50,7 +50,7 @@ def caveCmp(x, y):
|
||||
|
||||
def caveindex(request):
|
||||
caves = Cave.objects.all()
|
||||
notablecavehrefs = [ "161", "204", "258", "76", "107" ] # could detect notability by trips and notability of people who have been down them
|
||||
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"))
|
||||
|
@ -30,6 +30,8 @@ SITE_ID = 1
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = True
|
||||
|
||||
FIX_PERMISSIONS = []
|
||||
NOTABLECAVESHREFS = [ "161", "204", "258", "76", "107", "264" ]
|
||||
|
||||
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
||||
# trailing slash.
|
||||
|
Loading…
Reference in New Issue
Block a user