mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-01-31 07:22:32 +00:00
[svn] Added cavedescription and new subcave.
Changed parsers/survex to read *title into subcave
This commit is contained in:
parent
92635f6f68
commit
c132477f80
@ -95,6 +95,8 @@ admin.site.register(Area)
|
||||
admin.site.register(OtherCaveName)
|
||||
admin.site.register(CaveAndEntrance)
|
||||
admin.site.register(SurveyStation)
|
||||
admin.site.register(NewSubCave)
|
||||
admin.site.register(CaveDescription)
|
||||
admin.site.register(Entrance)
|
||||
admin.site.register(SurvexBlock, SurvexBlockAdmin)
|
||||
admin.site.register(Expedition)
|
||||
|
@ -479,13 +479,27 @@ class Subcave(TroggleModel):
|
||||
# urlString='cave/'+unicode(cave.kataster_number)+'/'+urlString
|
||||
# else:
|
||||
# urlString='cave/'+unicode(self.cave.kataster_number)+'/'+urlString
|
||||
|
||||
|
||||
|
||||
# return urlparse.urljoin(settings.URL_ROOT, urlString)
|
||||
try:
|
||||
mptt.register(Subcave, order_insertion_by=['title'])
|
||||
except mptt.AlreadyRegistered:
|
||||
print "mptt already registered"
|
||||
|
||||
class CaveDescription(TroggleModel):
|
||||
name = models.CharField(max_length=50)
|
||||
description = models.TextField(blank=True,null=True)
|
||||
linked_subcaves = models.ManyToManyField("Subcave")
|
||||
linked_entrances = models.ManyToManyField("Entrance")
|
||||
linked_qms = models.ManyToManyField("QM")
|
||||
def __unicode__(self):
|
||||
return unicode(self.name)
|
||||
|
||||
class NewSubCave(TroggleModel):
|
||||
name = models.CharField(max_length=200)
|
||||
def __unicode__(self):
|
||||
return unicode(self.name)
|
||||
|
||||
class QM(TroggleModel):
|
||||
#based on qm.csv in trunk/expoweb/smkridge/204 which has the fields:
|
||||
|
@ -28,7 +28,8 @@ re_include_no_extension = re.compile(r"^\s*\*include\s+([^\s]*)\s*$", re.IGNOREC
|
||||
flags = {"begin": re.compile(r"^\s*\*begin\s+(.*?)\s*$", re.IGNORECASE),
|
||||
"end": re.compile(r"^\s*\*end\s+(.*?)\s*$", re.IGNORECASE),
|
||||
"date": re.compile(r"^\s*\*date\s+(.*?)\s*$", re.IGNORECASE),
|
||||
"team": re.compile(r"^\s*\*team\s+(.*?)\s*$", re.IGNORECASE)}
|
||||
"team": re.compile(r"^\s*\*team\s+(.*?)\s*$", re.IGNORECASE),
|
||||
"title": re.compile(r"^\s*\*title\s+(.*?)\s*$", re.IGNORECASE)}
|
||||
|
||||
def fileIterator(directory, filename):
|
||||
survex_file = os.path.join(directory, filename + ".svx")
|
||||
@ -132,6 +133,9 @@ def make_model(name, parent, iter_lines, sf, c, l):
|
||||
team.append((survex_file, h.groups()))
|
||||
else:
|
||||
print ("Role not found: " + line + " in: " + sf).encode('ascii', 'xmlcharrefreplace')
|
||||
elif res["title"]:
|
||||
nsb, success = models.NewSubCave.objects.get_or_create(name = res["title"].groups()[0])
|
||||
|
||||
m.text = m.text + line
|
||||
saveEnd(survex_file, count)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user