mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
[svn] Various bug fixes, using more raw_id fields in admin so it loads faster. I had to put onLoad="contentHeight();" back into the base template. This is a bad solution, I would rather use Martin's, but it wasn't working.
This commit is contained in:
parent
84ad39f24a
commit
263b640641
@ -57,6 +57,7 @@ class PersonTripInline(admin.TabularInline):
|
||||
#class LogbookEntryAdmin(VersionAdmin):
|
||||
class LogbookEntryAdmin(TroggleModelAdmin):
|
||||
prepopulated_fields = {'slug':("title",)}
|
||||
raw_id_fields = ('cave','author')
|
||||
search_fields = ('title','expedition__year')
|
||||
date_heirarchy = ('date')
|
||||
inlines = (PersonTripInline, PhotoInline, QMsFoundInline)
|
||||
|
@ -145,7 +145,8 @@ def wiki_to_html_short(value, autoescape=None):
|
||||
#make subcave links
|
||||
value = re.sub("\[\[\s*subcave:(.+)\|(.+)\]\]",r'<a href="%s/subcave/\1/">\2</a>' % url_root, value, re.DOTALL)
|
||||
#make cavedescription links
|
||||
value = re.sub("\[\[\s*cavedescription:(.+)\|(.+)\]\]",r'<a href="%s/cavedescription/\2/">\2</a>' % url_root, value, re.DOTALL)
|
||||
value = re.sub("\[\[\s*cavedescription:(.+)\|(.+)\]\]",r'<a href="%s/cavedescription/\1/">\2</a>' % url_root, value, re.DOTALL)
|
||||
|
||||
|
||||
|
||||
#Make lists from lines starting with lists of [stars and hashes]
|
||||
|
@ -37,7 +37,7 @@ def qm(request,cave_id,qm_id,year,grade=None):
|
||||
return render_with_context(request,'qm.html',locals())
|
||||
|
||||
except QM.DoesNotExist:
|
||||
url=urlparse.urljoin(settings.URL_ROOT, r'/admin/expo/qm/add/'+'?'+ r'number=' + qm_id)
|
||||
url=urlparse.urljoin(settings.URL_ROOT, r'/admin/core/qm/add/'+'?'+ r'number=' + qm_id)
|
||||
if grade:
|
||||
url += r'&grade=' + grade
|
||||
return HttpResponseRedirect(url)
|
||||
@ -76,5 +76,4 @@ def survey(request,year,wallet_number):
|
||||
|
||||
def cave_description(request, cavedescription_name):
|
||||
cave_description = get_object_or_404(CaveDescription, short_name = cavedescription_name)
|
||||
print cave_description.long_name
|
||||
return render_with_context(request,'cave_description.html', locals())
|
@ -161,7 +161,7 @@ def logbook_entry_suggestions(request):
|
||||
Generates a html box with suggestions about what to do with QMs
|
||||
in logbook entry text.
|
||||
"""
|
||||
unwiki_QM_pattern=r"(?P<whole>(?P<explorer_code>[ABC]?)(?P<cave>\d*)-?(?P<year>\d\d\d?\d?)-(?P<number>\d\d)(?P<grade>[ABCDXV]?)(?=\s))"
|
||||
unwiki_QM_pattern=r"(?P<whole>(?P<explorer_code>[ABC]?)(?P<cave>\d*)-?(?P<year>\d\d\d?\d?)-(?P<number>\d\d)(?P<grade>[ABCDXV]?))"
|
||||
unwiki_QM_pattern=re.compile(unwiki_QM_pattern)
|
||||
#wikilink_QM_pattern=settings.QM_PATTERN
|
||||
|
||||
@ -174,18 +174,24 @@ def logbook_entry_suggestions(request):
|
||||
|
||||
print unwiki_QMs
|
||||
for qm in unwiki_QMs:
|
||||
if len(qm['year'])==2:
|
||||
if int(qm['year'])<50:
|
||||
qm['year']='20'+qm['year']
|
||||
else:
|
||||
qm['year']='19'+qm['year']
|
||||
#try:
|
||||
if len(qm['year'])==2:
|
||||
if int(qm['year'])<50:
|
||||
qm['year']='20'+qm['year']
|
||||
else:
|
||||
qm['year']='19'+qm['year']
|
||||
|
||||
temp_QM=QM(found_by=lbo,number=qm['number'],grade=qm['grade'])
|
||||
try:
|
||||
temp_QM.grade=unwiki_QM['grade']
|
||||
except:
|
||||
pass
|
||||
qm['wikilink']=temp_QM.wiki_link()
|
||||
if lbo.date.year!=int(qm['year']):
|
||||
try:
|
||||
lbo=LogbookEntry.objects.get(date__year=qm['year'],title__icontains="placeholder for QMs in")
|
||||
except:
|
||||
print "failed to get placeholder for year "+str(qm['year'])
|
||||
|
||||
temp_QM=QM(found_by=lbo,number=qm['number'],grade=qm['grade'])
|
||||
temp_QM.grade=qm['grade']
|
||||
qm['wikilink']=temp_QM.wiki_link()
|
||||
#except:
|
||||
#print 'failed'
|
||||
|
||||
print unwiki_QMs
|
||||
|
||||
|
@ -39,7 +39,7 @@ def parseDescriptions():
|
||||
|
||||
cd.save()
|
||||
|
||||
def parseDescriptionsInCaveObjects():
|
||||
def parseDescriptionsOnCaveObjects():
|
||||
for cave in models.Cave.objects.all():
|
||||
cave.underground_description=html_to_wiki(unicode(cave.underground_description))
|
||||
cave.save()
|
@ -13,7 +13,7 @@
|
||||
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<body onLoad="contentHeight();">
|
||||
|
||||
<div id="header">
|
||||
<h1>CUCC Expeditions to Austria: 1976 - 2009</h1>
|
||||
|
@ -59,7 +59,7 @@
|
||||
{% for personexpedition in expedition.personexpedition_set.all %}
|
||||
<tr>
|
||||
<td class="name">
|
||||
<a href="">{{ personexpedition.person }}</a>
|
||||
<a href="{{ personexpedition.person.get_absolute_url }}">{{ personexpedition.person }}</a>
|
||||
|
||||
</td>
|
||||
{% if personexpedition.ListDaysTF %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "cavebase.html" %}
|
||||
{% load wiki_markup %}
|
||||
{% block title %} {{cave_description.short_name}} {% endblock title %}
|
||||
{% block title %} {{cave_description}} {% endblock title %}
|
||||
{% block editLink %}<a href={{cave_description.get_admin_url}}>Edit description {{cave_description}}</a>{% endblock %}
|
||||
|
||||
{% block contentheader %}
|
||||
|
@ -31,7 +31,7 @@
|
||||
<table>
|
||||
{% for personrole in survexblock.GetPersonroles %}
|
||||
<tr>
|
||||
<td><a href="{{personrole.get_absolute_url}}">{{personrole.person}}</a></td>
|
||||
<td><a href="{{personrole.person.get_absolute_url}}">{{personrole.person}}</a></td>
|
||||
<td>{{personrole.roles}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
3
urls.py
3
urls.py
@ -32,7 +32,8 @@ urlpatterns = patterns('',
|
||||
|
||||
url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"),
|
||||
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cave, name="cave"),
|
||||
url(r'^cavedescription/(?P<cavedescription_name>[^/]*)/$', views_caves.cave_description, name="cavedescription"),
|
||||
url(r'^cavedescription/(?P<cavedescription_name>[^/]+)/?$', views_caves.cave_description, name="cavedescription"),
|
||||
url(r'^cavedescription/?$', object_list, {'queryset':CaveDescription.objects.all(),'template_name':'object_list.html'}, name="cavedescriptions"),
|
||||
#url(r'^cavehref/(.+)$', views_caves.cave, name="cave"),url(r'cave'),
|
||||
|
||||
url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
|
||||
|
12
utils.py
12
utils.py
@ -102,7 +102,7 @@ def href_to_wikilinks(matchobj):
|
||||
if res:
|
||||
return r'[[cavedescription:'+res[0].short_name+'|'+res[0].long_name+']]'
|
||||
else:
|
||||
return matchobj
|
||||
return matchobj.group()
|
||||
#except:
|
||||
#print 'fail'
|
||||
|
||||
@ -115,13 +115,15 @@ re_subs = [(re.compile(r"\<b[^>]*\>(.*?)\</b\>", re.DOTALL), r"'''\1'''"),
|
||||
(re.compile(r"\<h4[^>]*\>(.*?)\</h4\>", re.DOTALL), r"====\1===="),
|
||||
(re.compile(r"\<h5[^>]*\>(.*?)\</h5\>", re.DOTALL), r"=====\1====="),
|
||||
(re.compile(r"\<h6[^>]*\>(.*?)\</h6\>", re.DOTALL), r"======\1======"),
|
||||
(re.compile(r'(<a href="?(?P<target>.*)"?>)?<img class="?(?P<class>\w*)"? src="?t/?(?P<source>[\w/\.]*)"?(?P<rest>></img>|\s/>(</a>)?)', re.DOTALL),r'[[display:\g<class> photo:\g<source>]]'), #
|
||||
(re.compile(r"\<a\s+id=['\"]([^'\"]*)['\"]\s*\>(.*?)\</a\>", re.DOTALL), r"[[subcave:\1|\2]]"), #assumes that all links with id attributes are subcaves. Not great.
|
||||
#interpage link needed
|
||||
(re.compile(r"\<a\s+href=['\"]#([^'\"]*)['\"]\s*\>(.*?)\</a\>", re.DOTALL), r"[[cavedescription:\1|\2]]"), #assumes that all links with target ids are subcaves. Not great.
|
||||
(re.compile(r"\<a\s+href=['\"]#([^'\"]*)['\"]\s*\>(.*?)\</a\>", re.DOTALL), r"[[cavedescription:\1|\2]]"), #assumes that all links with target ids are cave descriptions. Not great.
|
||||
(re.compile(r"\[\<a\s+href=['\"][^'\"]*['\"]\s+id=['\"][^'\"]*['\"]\s*\>([^\s]*).*?\</a\>\]", re.DOTALL), r"[[qm:\1]]"),
|
||||
|
||||
# BUGGED!
|
||||
# (re.compile(r'<a\shref="?(?P<target>.*)"?>(?P<text>.*)</a>'),href_to_wikilinks)
|
||||
|
||||
#BUGGED!
|
||||
(re.compile(r'<a\shref="?(?P<target>.*)"?>(?P<text>.*)</a>'),href_to_wikilinks),
|
||||
|
||||
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user