mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 02:57:04 +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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user