summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/admin.py13
-rw-r--r--core/management/commands/reset_db.py8
-rw-r--r--core/models.py37
-rw-r--r--core/models_survex.py6
-rw-r--r--core/templatetags/wiki_markup.py16
-rw-r--r--core/views_logbooks.py2
-rw-r--r--core/views_other.py6
7 files changed, 50 insertions, 38 deletions
diff --git a/core/admin.py b/core/admin.py
index 71bbd61..18fb404 100644
--- a/core/admin.py
+++ b/core/admin.py
@@ -50,10 +50,10 @@ class QMsFoundInline(admin.TabularInline):
extra=1
-class PhotoInline(admin.TabularInline):
- model = DPhoto
- exclude = ['is_mugshot' ]
- extra = 1
+# class PhotoInline(admin.TabularInline):
+ # model = DPhoto
+ # exclude = ['is_mugshot' ]
+ # extra = 1
class PersonTripInline(admin.TabularInline):
@@ -67,7 +67,8 @@ class LogbookEntryAdmin(TroggleModelAdmin):
prepopulated_fields = {'slug':("title",)}
search_fields = ('title','expedition__year')
date_heirarchy = ('date')
- inlines = (PersonTripInline, PhotoInline, QMsFoundInline)
+# inlines = (PersonTripInline, PhotoInline, QMsFoundInline)
+ inlines = (PersonTripInline, QMsFoundInline)
class Media:
css = {
"all": ("css/troggleadmin.css",)
@@ -116,7 +117,7 @@ class EntranceAdmin(TroggleModelAdmin):
search_fields = ('caveandentrance__cave__kataster_number',)
-admin.site.register(DPhoto)
+#admin.site.register(DPhoto)
admin.site.register(Cave, CaveAdmin)
admin.site.register(Area)
#admin.site.register(OtherCaveName)
diff --git a/core/management/commands/reset_db.py b/core/management/commands/reset_db.py
index e95ddd9..c55a0b1 100644
--- a/core/management/commands/reset_db.py
+++ b/core/management/commands/reset_db.py
@@ -11,6 +11,9 @@ from django.core.urlresolvers import reverse
from troggle.core.models import Cave, Entrance
import troggle.flatpages.models
+"""Pretty much all of this is now replaced by databaseRest.py
+I don't know why this still exists
+"""
databasename=settings.DATABASES['default']['NAME']
expouser=settings.EXPOUSER
expouserpass=settings.EXPOUSERPASS
@@ -89,9 +92,10 @@ class Command(BaseCommand):
def make_dirs(obj):
"""Make directories that troggle requires"""
+ pass
# should also deal with permissions here.
- if not os.path.isdir(settings.PHOTOS_ROOT):
- os.mkdir(settings.PHOTOS_ROOT)
+ #if not os.path.isdir(settings.PHOTOS_ROOT):
+ #os.mkdir(settings.PHOTOS_ROOT)
def import_caves(obj):
import parsers.caves
diff --git a/core/models.py b/core/models.py
index 0efe8c9..5b9f48c 100644
--- a/core/models.py
+++ b/core/models.py
@@ -780,31 +780,32 @@ class QM(TroggleModel):
def wiki_link(self):
return u"%s%s%s" % ('[[QM:',self.code(),']]')
-photoFileStorage = FileSystemStorage(location=settings.PHOTOS_ROOT, base_url=settings.PHOTOS_URL)
-class DPhoto(TroggleImageModel):
- caption = models.CharField(max_length=1000,blank=True,null=True)
- contains_logbookentry = models.ForeignKey(LogbookEntry,blank=True,null=True)
- contains_person = models.ManyToManyField(Person,blank=True,null=True)
- file = models.ImageField(storage=photoFileStorage, upload_to='.',)
- is_mugshot = models.BooleanField(default=False)
- contains_cave = models.ForeignKey(Cave,blank=True,null=True)
- contains_entrance = models.ForeignKey(Entrance, related_name="photo_file",blank=True,null=True)
+#photoFileStorage = FileSystemStorage(location=settings.PHOTOS_ROOT, base_url=settings.PHOTOS_URL)
+#class DPhoto(TroggleImageModel):
+ #caption = models.CharField(max_length=1000,blank=True,null=True)
+ #contains_logbookentry = models.ForeignKey(LogbookEntry,blank=True,null=True)
+ #contains_person = models.ManyToManyField(Person,blank=True,null=True)
+ # replace link to copied file with link to original file location
+ #file = models.ImageField(storage=photoFileStorage, upload_to='.',)
+ #is_mugshot = models.BooleanField(default=False)
+ #contains_cave = models.ForeignKey(Cave,blank=True,null=True)
+ #contains_entrance = models.ForeignKey(Entrance, related_name="photo_file",blank=True,null=True)
#nearest_survey_point = models.ForeignKey(SurveyStation,blank=True,null=True)
- nearest_QM = models.ForeignKey(QM,blank=True,null=True)
- lon_utm = models.FloatField(blank=True,null=True)
- lat_utm = models.FloatField(blank=True,null=True)
+ #nearest_QM = models.ForeignKey(QM,blank=True,null=True)
+ #lon_utm = models.FloatField(blank=True,null=True)
+ #lat_utm = models.FloatField(blank=True,null=True)
- class IKOptions:
- spec_module = 'core.imagekit_specs'
- cache_dir = 'thumbs'
- image_field = 'file'
+ # class IKOptions:
+ # spec_module = 'core.imagekit_specs'
+ # cache_dir = 'thumbs'
+ # image_field = 'file'
#content_type = models.ForeignKey(ContentType)
#object_id = models.PositiveIntegerField()
#location = generic.GenericForeignKey('content_type', 'object_id')
- def __unicode__(self):
- return self.caption
+ # def __unicode__(self):
+ # return self.caption
scansFileStorage = FileSystemStorage(location=settings.SURVEY_SCANS, base_url=settings.SURVEYS_URL)
def get_scan_path(instance, filename):
diff --git a/core/models_survex.py b/core/models_survex.py
index 3bae04c..448cea9 100644
--- a/core/models_survex.py
+++ b/core/models_survex.py
@@ -197,6 +197,9 @@ class SurvexScansFolder(models.Model):
def get_absolute_url(self):
return urlparse.urljoin(settings.URL_ROOT, reverse('surveyscansfolder', kwargs={"path":re.sub("#", "%23", self.walletname)}))
+
+ def __unicode__(self):
+ return unicode(self.walletname) + " (Survey Scans Folder)"
class SurvexScanSingle(models.Model):
ffile = models.CharField(max_length=200)
@@ -208,6 +211,9 @@ class SurvexScanSingle(models.Model):
def get_absolute_url(self):
return urlparse.urljoin(settings.URL_ROOT, reverse('surveyscansingle', kwargs={"path":re.sub("#", "%23", self.survexscansfolder.walletname), "file":self.name}))
+
+ def __unicode__(self):
+ return "Survey Scan Image: " + unicode(self.name) + " in " + unicode(self.survexscansfolder)
class TunnelFile(models.Model):
diff --git a/core/templatetags/wiki_markup.py b/core/templatetags/wiki_markup.py
index 2640594..25c7103 100644
--- a/core/templatetags/wiki_markup.py
+++ b/core/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 troggle.core.models import QM, DPhoto, LogbookEntry, Cave
+from troggle.core.models import QM, LogbookEntry, Cave
import re, urlparse
register = template.Library()
@@ -120,13 +120,13 @@ def wiki_to_html_short(value, autoescape=None):
except KeyError:
linkText=None
- try:
- photo=DPhoto.objects.get(file=matchdict['photoName'])
- if not linkText:
- linkText=str(photo)
- res=r'<a href=' + photo.get_admin_url() +'>' + linkText + '</a>'
- except Photo.DoesNotExist:
- res = r'<a class="redtext" href="">make new photo</a>'
+ # try:
+ # photo=DPhoto.objects.get(file=matchdict['photoName'])
+ # if not linkText:
+ # linkText=str(photo)
+ # res=r'<a href=' + photo.get_admin_url() +'>' + linkText + '</a>'
+ # except Photo.DoesNotExist:
+ # res = r'<a class="redtext" href="">make new photo</a>'
return res
def photoSrcRepl(matchobj):
diff --git a/core/views_logbooks.py b/core/views_logbooks.py
index 9891674..65453fa 100644
--- a/core/views_logbooks.py
+++ b/core/views_logbooks.py
@@ -184,7 +184,7 @@ def pathsreport(request):
"MEDIA_ADMIN_DIR" : MEDIA_ADMIN_DIR,
"MEDIA_ROOT" : MEDIA_ROOT,
"MEDIA_URL" : MEDIA_URL,
- "PHOTOS_ROOT" : PHOTOS_ROOT,
+ #"PHOTOS_ROOT" : PHOTOS_ROOT,
"PHOTOS_URL" : PHOTOS_URL,
"PYTHON_PATH" : PYTHON_PATH,
"REPOS_ROOT_PATH" : REPOS_ROOT_PATH,
diff --git a/core/views_other.py b/core/views_other.py
index cc9782b..6adca9c 100644
--- a/core/views_other.py
+++ b/core/views_other.py
@@ -1,5 +1,5 @@
-from troggle.core.models import Cave, Expedition, Person, LogbookEntry, PersonExpedition, PersonTrip, DPhoto, QM
-#from troggle.core.forms import UploadFileForm
+from troggle.core.models import Cave, Expedition, Person, LogbookEntry, PersonExpedition, PersonTrip, QM
+#from troggle.core.forms import UploadFileForm, DPhoto
from django.conf import settings
from django import forms
from django.template import loader, Context
@@ -30,7 +30,7 @@ def frontpage(request):
expeditions = Expedition.objects.order_by("-year")
logbookentry = LogbookEntry
cave = Cave
- photo = DPhoto
+ #photo = DPhoto
from django.contrib.admin.templatetags import log
return render(request,'frontpage.html', locals())