diff --git a/troggle/expo/views_logbooks.py b/troggle/expo/views_logbooks.py index e4a3905eb..9d69099fe 100644 --- a/troggle/expo/views_logbooks.py +++ b/troggle/expo/views_logbooks.py @@ -10,3 +10,8 @@ def person(request, person_id): person = Person.objects.filter(id = person_id)[0] return render_to_response('person.html', {'person': person, 'settings': settings}) +def logbookentry(request, logbookentry_id): + logbookentry = LogbookEntry.objects.filter(id = logbookentry_id)[0] + return render_to_response('logbookentry.html', {'logbookentry': logbookentry, 'settings': settings}) + + diff --git a/troggle/localsettingsserver.py b/troggle/localsettingsserver.py index 81f28818f..72df43c5c 100644 --- a/troggle/localsettingsserver.py +++ b/troggle/localsettingsserver.py @@ -1,5 +1,5 @@ DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_NAME = 'undemocracy' # Or path to database file if using sqlite3. +DATABASE_NAME = 'troggle' # Or path to database file if using sqlite3. DATABASE_USER = 'undemocracy' # Not used with sqlite3. DATABASE_PASSWORD = 'aiGohsh5' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. @@ -7,4 +7,4 @@ DATABASE_PORT = '' # Set to empty string for default. Not used with SURVEX_DATA = '' CAVERN = 'cavern' -EXPOWEB = '' \ No newline at end of file +EXPOWEB = '/home/mjg/expoweb' diff --git a/troggle/parsers/logbooks.py b/troggle/parsers/logbooks.py index 95e410f08..2c66a0de9 100644 --- a/troggle/parsers/logbooks.py +++ b/troggle/parsers/logbooks.py @@ -132,8 +132,8 @@ def Parselogwikitxt(year, expedition, txt): ldate = datetime.date(int(tripdate[:4]), int(tripdate[5:7]), int(tripdate[8:10])) print "ppp", trippeople, len(triptext) trippersons, author = GetTripPersons(trippeople, expedition) - triptext = triptext[:10] # seems to have aproblem with this - print "ttt", triptext + #triptext = triptext[:10] # seems to have aproblem with this + #print "ttt", triptext lbo = models.LogbookEntry(date = ldate, place = tripcave, title = tripsplace[-1], text = triptext, author=author) lbo.save() @@ -170,7 +170,10 @@ def Parseloghtmltxt(year, expedition, txt): #assert tripid[:-1] == "t" + tripdate, (tripid, tripdate) trippersons, author = GetTripPersons(trippeople, expedition) tripcave = "" - lbo = models.LogbookEntry(date = ldate, place = tripcave, title = triptitle, text = triptext, author=author) + ltriptext = re.sub("</p>", "", triptext) + ltriptext = re.sub("\s*?\n\s*", " ", ltriptext) + ltriptext = re.sub("<p>", "\n\n", ltriptext).strip() + lbo = models.LogbookEntry(date = ldate, place = tripcave, title = triptitle, text = ltriptext, author=author) lbo.save() tu = timeug or "" @@ -186,7 +189,7 @@ def LoadLogbooks(): models.LogbookEntry.objects.all().delete() expowebbase = os.path.join(settings.EXPOWEB, "years") yearlinks = [ -# ("2008", "2008/logbook/2008logbook.txt"), + ("2008", "2008/logbook/2008logbook.txt"), ("2007", "2007/logbook/2007logbook.txt"), ("2005", "2005/logbook.html"), ("2004", "2004/logbook.html"), @@ -210,4 +213,3 @@ def LoadLogbooks(): #LoadPersons() LoadLogbooks() - diff --git a/troggle/templates/person.html b/troggle/templates/person.html index c71020873..9d79141af 100644 --- a/troggle/templates/person.html +++ b/troggle/templates/person.html @@ -12,9 +12,11 @@ {{personexpedition.expedition}} </td><td> <div> + <ul> {% for persontrip in personexpedition.persontrip_set.all %} - <a href="/logbook/{{persontrip.logbookentry.id}}">{{persontrip.date}}</a> + <li><a href="/logbookentry/{{persontrip.logbookentry.id}}">{{persontrip.date}}</a> ({{persontrip.logbookentry.place}}) - {{persontrip.logbookentry.title}}</li> {% endfor %} + <ul> </div> </td></tr></table> </li> diff --git a/troggle/templates/personindex.html b/troggle/templates/personindex.html index 45591e61d..21fe262db 100644 --- a/troggle/templates/personindex.html +++ b/troggle/templates/personindex.html @@ -14,7 +14,7 @@ </td><td> <div> {% for persontrip in personexpedition.persontrip_set.all %} - <a href="/logbook/{{persontrip.logbookentry.id}}">{{persontrip.date}}</a> + <a href="/logbookentry/{{persontrip.logbookentry.id}}">{{persontrip.date}}</a> {% endfor %} </div> </td></tr></table> diff --git a/troggle/urls.py b/troggle/urls.py index 3be1a008c..c18045ed7 100644 --- a/troggle/urls.py +++ b/troggle/urls.py @@ -19,6 +19,8 @@ urlpatterns = patterns('', (r'^person/$', personindex), (r'^person/(.*)$', person), + (r'^logbookentry/(.*)$', logbookentry), + (r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/(.*)', admin.site.root),