diff --git a/README.txt b/README.txt index 72c4464..8806217 100644 --- a/README.txt +++ b/README.txt @@ -23,4 +23,9 @@ svn co http://troggle.googlecode.com/svn/ If you want to work on the source code and be able to commit, you will need to use https instead of http, and your google account will need to be added to the troggle project members list. Contact aaron dot curtis at cantab dot net to get this set up. -Next, you need to fill in your local settings. Copy either localsettingsubuntu.py or localsettingsserver.py to a new file called localsettings.py. Follow the instructions contained in the file to fill out your settings. \ No newline at end of file +Next, you need to fill in your local settings. Copy either localsettingsubuntu.py or localsettingsserver.py to a new file called localsettings.py. Follow the instructions contained in the file to fill out your settings. + + +Importing legacy data +--------------------- +Once troggle is running, log in and then go to "Import / export" data under "admin" on the menu \ No newline at end of file diff --git a/expo/templatetags/wiki_markup.py b/expo/templatetags/wiki_markup.py index 8910065..4bcd07d 100644 --- a/expo/templatetags/wiki_markup.py +++ b/expo/templatetags/wiki_markup.py @@ -3,7 +3,7 @@ from django.utils.html import conditional_escape from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from django.conf import settings -from expo.models import QM +from expo.models import QM, Photo import re, urlparse register = template.Library() @@ -76,30 +76,51 @@ def wiki_to_html_short(value, autoescape=None): [[cave:204 QM:1999-24C]] where the grade (C) is optional. If the QM does not exist, the function will return a link for creating it. """ + # if there are four matched groups, the fourth one should be the QM grade if len(matchobj.groups())==4: - # if there are four matched groups, then grade=matchobj.groups()[3] else: grade='' qmdict={'urlroot':url_root,'cave':matchobj.groups()[0],'year':matchobj.groups()[1],'number':matchobj.groups()[2],'grade':grade} try: qm=QM.objects.get(found_by__cave__kataster_number=qmdict['cave'],found_by__date__year=qmdict['year'], number=qmdict['number']) - url=r'' + str(qm) + '' + res=r'' + str(qm) + '' except QM.DoesNotExist: - url = r'%(cave)s:%(year)s-%(number)s%(grade)s' % qmdict - return url - - #make qm links + res = r'%(cave)s:%(year)s-%(number)s%(grade)s' % qmdict + return res value = re.sub(qmMatchPattern,qmrepl, value, re.DOTALL) - #qms=qmfinder.search(value) - #for qm in qms: - #if QM.objects.filter(cave__kataster_number=qm[0], found_by__year=qm[1], number=qm[2]).count >= 1: # If there is at lesat one QM matching this query - #replace qm with link in red - #else - #replace qm with link in blue - - #turn qm links red if nonexistant + #make photo links for [[photo:filename]] or [[photo:filename linktext]], and + #insert photos for [[display:left photo:filename]] + photoLinkPattern="\[\[\s*photo:(?P[^\s]+)\s*(?P.*)\]\]" + photoSrcPattern="\[\[\s*display:(?P