summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/TESTS/tests.py5
-rw-r--r--core/models_caves.py2
-rw-r--r--core/models_survex.py16
3 files changed, 16 insertions, 7 deletions
diff --git a/core/TESTS/tests.py b/core/TESTS/tests.py
index 0e46ba7..a433e02 100644
--- a/core/TESTS/tests.py
+++ b/core/TESTS/tests.py
@@ -1,4 +1,6 @@
"""
+We are using unittest for troggle.
+
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
@@ -42,7 +44,7 @@ class SimpleTest(SimpleTestCase):
from django.template.defaultfilters import slugify
from django.utils.timezone import get_current_timezone, make_aware
from troggle.core.models import DataIssue, Expedition
- from troggle.core.models_caves import Cave, OtherCaveName, getCaveByReference, LogbookEntry, PersonTrip
+ from troggle.core.models_caves import Cave, OtherCaveName, LogbookEntry, PersonTrip
from parsers.people import GetPersonExpeditionNameLookup
def test_import_core_views_caves(self):
from django.http import HttpResponse, HttpResponseRedirect
@@ -52,6 +54,7 @@ class SimpleTest(SimpleTestCase):
from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm
from troggle.helper import login_required_if_public
def test_import_parses_mix(self):
+ from troggle.parsers.logbooks import GetCaveLookup
import troggle.settings
import troggle.flatpages.models
import troggle.logbooksdump
diff --git a/core/models_caves.py b/core/models_caves.py
index e20b17f..8df2639 100644
--- a/core/models_caves.py
+++ b/core/models_caves.py
@@ -125,7 +125,7 @@ class Cave(TroggleModel):
return urljoin(settings.URL_ROOT, reverse('cave',kwargs={'cave_id':href,}))
def __str__(self, sep = ": "):
- return str(self.slug())
+ return "[Cave:" + str(self.slug()) + "]"
def get_QMs(self):
return QM.objects.filter(found_by__cave_slug=self.caveslug_set.all())
diff --git a/core/models_survex.py b/core/models_survex.py
index 4cbf611..89fe4a4 100644
--- a/core/models_survex.py
+++ b/core/models_survex.py
@@ -17,7 +17,7 @@ class SurvexDirectory(models.Model):
ordering = ('id',)
def __str__(self):
- return str(self.path) + "-" + str(self.primarysurvexfile.path)
+ return "[SurvexDirectory:"+str(self.path) + "-" + str(self.primarysurvexfile.path) + "-" + str(self.cave)+"]"
@@ -28,7 +28,10 @@ class SurvexFile(models.Model):
class Meta:
ordering = ('id',)
-
+
+ def __str__(self):
+ return "[SurvexFile:"+str(self.path) + "-" + str(self.survexdirectory) + "-" + str(self.cave)+"]"
+
def exists(self):
fname = os.path.join(settings.SURVEX_DATA, self.path + ".svx")
return os.path.isfile(fname)
@@ -114,12 +117,15 @@ class SurvexBlock(models.Model):
class Meta:
ordering = ('id',)
+ def __str__(self):
+ return "[SurvexBlock:"+ str(self.name) + "-path:" + \
+ str(self.survexpath) + "-cave:" + \
+ str(self.cave) + "]"
+
+
def isSurvexBlock(self): # Function used in templates
return True
- def __str__(self):
- return self.name and str(self.name) or 'no name'
-
def GetPersonroles(self):
res = [ ]
for personrole in self.personrole_set.order_by('personexpedition'):