2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-01-19 17:32:31 +00:00

[svn] * Added non-public field for protecting copyright info etc. Field is on all models but needs to be checked for in views. So far, only the cave view checks.

* Added the Person wiki syntax which looks like [[person:John Doe]]
This commit is contained in:
substantialnoninfringinguser 2009-06-10 06:34:50 +01:00
parent eed4fea255
commit 11c42ed60e
3 changed files with 11 additions and 4 deletions

View File

@ -21,7 +21,7 @@ logging.basicConfig(level=logging.DEBUG,
#This class is for adding fields and methods which all of our models will have.
class TroggleModel(models.Model):
new_since_parsing = models.BooleanField(default=False, editable=False)
non_public = models.BooleanField(default=False)
def object_name(self):
return self._meta.object_name

View File

@ -47,6 +47,9 @@ def wiki_to_html(value, autoescape=None):
@register.filter()
@stringfilter
def wiki_to_html_short(value, autoescape=None):
"""
This is the tag which turns wiki syntax into html. Aaron wonders why it is called "short." It is long, and it operates on long things.
"""
if autoescape:
value = conditional_escape(value)
#deescape doubly escaped characters
@ -58,10 +61,10 @@ def wiki_to_html_short(value, autoescape=None):
#make cave links
value = re.sub("\[\[\s*cave:([^\s]+)\s*\s*\]\]", r'<a href="%s/cave/\1/">\1</a>' % settings.URL_ROOT, value, re.DOTALL)
#make people links
value = re.sub("\[\[\s*person:(.+)\]\]",r'<a href="%s/person/\1/">\1</a>' % settings.URL_ROOT, value, re.DOTALL)
#make qm links. this takes a little doing
qmMatchPattern="\[\[\s*cave:([^\s]+)\s*\s*\QM:(\d*)-(\d*)([ABCDX]?)\]\]"
def qmrepl(matchobj):
"""
A function for replacing wikicode qm links with html qm links.

View File

@ -24,7 +24,11 @@ def caveindex(request):
return render_response(request,'caveindex.html', {'caves': caves, 'notablecaves':notablecaves})
def cave(request, cave_id='', offical_name=''):
return render_response(request,'cave.html', {'cave': getCave(cave_id),})
cave=getCave(cave_id)
if cave.non_public:
return render_response(request,'nonpublic.html', {'instance': cave})
else:
return render_response(request,'cave.html', {'cave': cave})
def qm(request,cave_id,qm_id,year,grade=None):
year=int(year)