From 29adaa03c6809169411b5f2cc8a11a3b5c25d1f2 Mon Sep 17 00:00:00 2001
From: expo <expo@seagrass.goatchurch.org.uk>
Date: Sat, 29 Aug 2009 18:08:55 +0100
Subject: [PATCH] get rid of photo

---
 parsers/people.py    |  4 ++--
 parsers/surveys.py   | 12 ++++++------
 templates/tasks.html |  6 +++---
 urls.py              |  4 ++++
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/parsers/people.py b/parsers/people.py
index fd269e6..7898ccd 100644
--- a/parsers/people.py
+++ b/parsers/people.py
@@ -11,14 +11,14 @@ def saveMugShot(mugShotPath, mugShotFilename, person):
     else:
         mugShotFilename=mugShotFilename # just in case one doesn't
     
-    dummyObj=models.Photo(file=mugShotFilename)
+    dummyObj=models.DPhoto(file=mugShotFilename)
     
     #Put a copy of the file in the right place. mugShotObj.file.path is determined by the django filesystemstorage specified in models.py
     if not os.path.exists(dummyObj.file.path):
         shutil.copy(mugShotPath, dummyObj.file.path)
     
     mugShotObj, created = save_carefully(
-        models.Photo,
+        models.DPhoto,
         lookupAttribs={'is_mugshot':True, 'file':mugShotFilename},
         nonLookupAttribs={'caption':"Mugshot for "+person.first_name+" "+person.last_name}
         )
diff --git a/parsers/surveys.py b/parsers/surveys.py
index fc7fb7f..ff78355 100644
--- a/parsers/surveys.py
+++ b/parsers/surveys.py
@@ -25,11 +25,11 @@ def get_or_create_placeholder(year):
     return placeholder_logbook_entry
 
 def readSurveysFromCSV():
-    try:
-        surveytab = open(os.path.join(settings.SURVEYS, "Surveys.csv"))
+    try:   # could probably combine these two
+        surveytab = open(os.path.join(settings.SURVEY_SCANS, "Surveys.csv"))
     except IOError:
-        import cStringIO, urllib
-        surveytab = cStringIO.StringIO(urllib.urlopen(settings.SURVEYS + "download/Surveys.csv").read())
+        import cStringIO, urllib  
+        surveytab = cStringIO.StringIO(urllib.urlopen(settings.SURVEY_SCANS + "/Surveys.csv").read())
     dialect=csv.Sniffer().sniff(surveytab.read())
     surveytab.seek(0,0)
     surveyreader = csv.reader(surveytab,dialect=dialect)
@@ -87,7 +87,7 @@ def listdir(*directories):
 # add survey scans
 def parseSurveyScans(year, logfile=None):
 #    yearFileList = listdir(year.year)
-    yearPath=os.path.join(settings.SURVEY_SCANS, year.year)
+    yearPath=os.path.join(settings.SURVEY_SCANS, "years", year.year)
     yearFileList=os.listdir(yearPath)
     print yearFileList
     for surveyFolder in yearFileList:
@@ -145,4 +145,4 @@ def isInterlacedPNG(filePath): #We need to check for interlaced PNGs because the
     if 'interlace' in file.info:
         return file.info['interlace']
     else:
-        return False
\ No newline at end of file
+        return False
diff --git a/templates/tasks.html b/templates/tasks.html
index d73d74b..a429bd5 100644
--- a/templates/tasks.html
+++ b/templates/tasks.html
@@ -9,8 +9,8 @@
 
 <h3>Add new data</h3>
 
-<li><a href="{% url admin_core_photo_add %}">Upload a photo</a></li>
-<li><a href="{% url admin_core_logbookentry_add %}">Record a new trip</a></li>
+<li><a href="">Upload a photo</a></li>
+<li><a href="">Record a new trip</a></li>
 
 <h3>Your unfinished business</h3>
     {% for survey in surveys_unfinished %}
@@ -36,4 +36,4 @@ add wikilinks
 {% block margins %}
 <img class="leftMargin eyeCandy fadeIn" src="{{ settings.MEDIA_URL }}eieshole.jpg">
 <img class="rightMargin eyeCandy fadeIn" src="{{ settings.MEDIA_URL }}goesser.jpg">
-{% endblock margins %}
\ No newline at end of file
+{% endblock margins %}
diff --git a/urls.py b/urls.py
index 902f8bc..e653649 100644
--- a/urls.py
+++ b/urls.py
@@ -69,6 +69,10 @@ urlpatterns = patterns('',
 
     (r'^admin/doc/?', include('django.contrib.admindocs.urls')),
     url(r'^admin/(.*)', admin.site.root, name="admin"),
+    
+    # don't know why this needs troggle/ in here.  nice to get it out
+    url(r'^troggle/media-admin/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ADMIN_DIR, 'show_indexes':True}),
+
 
     (r'^accounts/', include('registration.urls')),
     (r'^profiles/', include('profiles.urls')),