forked from expo/troggle
fixing parent blocks & titles
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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'):
|
||||
|
||||
Reference in New Issue
Block a user