mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2025-02-18 13:10:20 +00:00
[svn r8076] Djangoed Julians code
added underscores to field names turned __str__ to __unicode__
This commit is contained in:
parent
f08d6b6ecf
commit
b85c962575
@ -8,18 +8,18 @@ class Expedition(models.Model):
|
|||||||
start_date = models.DateField(blank=True,null=True)
|
start_date = models.DateField(blank=True,null=True)
|
||||||
end_date = models.DateField(blank=True,null=True)
|
end_date = models.DateField(blank=True,null=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __unicode__(self):
|
||||||
return self.year
|
return self.year
|
||||||
|
|
||||||
def GetPersonExpedition(self, name):
|
def GetPersonExpedition(self, name):
|
||||||
personexpeditions = PersonExpedition.objects.filter(expedition=self)
|
person_expeditions = PersonExpedition.objects.filter(expedition=self)
|
||||||
res = None
|
res = None
|
||||||
for personexpedition in personexpeditions:
|
for person_expedition in person_expeditions:
|
||||||
for possiblenameform in personexpedition.GetPossibleNameForms():
|
for possible_name_from in person_expedition.GetPossibleNameForms():
|
||||||
#print "nnn", possiblenameform
|
#print "nnn", possiblenamefrom
|
||||||
if name == possiblenameform:
|
if name == possible_name_from:
|
||||||
assert not res, "Ambiguous: " + name
|
assert not res, "Ambiguous: " + name
|
||||||
res = personexpedition
|
res = person_expedition
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class Person(models.Model):
|
|||||||
last_name = models.CharField(max_length=100)
|
last_name = models.CharField(max_length=100)
|
||||||
is_vfho = models.BooleanField()
|
is_vfho = models.BooleanField()
|
||||||
mug_shot = models.CharField(max_length=100, blank=True,null=True)
|
mug_shot = models.CharField(max_length=100, blank=True,null=True)
|
||||||
def __str__(self):
|
def __unicode__(self):
|
||||||
return "%s %s" % (self.first_name, self.last_name)
|
return "%s %s" % (self.first_name, self.last_name)
|
||||||
|
|
||||||
class PersonExpedition(models.Model):
|
class PersonExpedition(models.Model):
|
||||||
@ -49,7 +49,7 @@ class PersonExpedition(models.Model):
|
|||||||
res.append(self.nickname)
|
res.append(self.nickname)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def __str__(self):
|
def __unicode__(self):
|
||||||
return "%s: (%s)" % (self.person, self.expedition)
|
return "%s: (%s)" % (self.person, self.expedition)
|
||||||
|
|
||||||
|
|
||||||
@ -64,22 +64,22 @@ class LogbookEntry(models.Model):
|
|||||||
|
|
||||||
# several PersonTrips point in to this object
|
# several PersonTrips point in to this object
|
||||||
|
|
||||||
def __str__(self):
|
def __unicode__(self):
|
||||||
return "%s: (%s)" % (self.date, self.title)
|
return "%s: (%s)" % (self.date, self.title)
|
||||||
|
|
||||||
class PersonTrip(models.Model):
|
class PersonTrip(models.Model):
|
||||||
personexpedition = models.ForeignKey(PersonExpedition)
|
person_expedition = models.ForeignKey(PersonExpedition)
|
||||||
|
|
||||||
# this will be a foreign key of the place(s) the trip went through
|
# this will be a foreign key of the place(s) the trip went through
|
||||||
# possibly a trip has a plurality of triplets pointing into it
|
# possibly a trip has a plurality of triplets pointing into it
|
||||||
place = models.CharField(max_length=100)
|
place = models.CharField(max_length=100)
|
||||||
date = models.DateField()
|
date = models.DateField()
|
||||||
timeunderground = models.CharField(max_length=100)
|
time_underground = models.CharField(max_length=100)
|
||||||
logbookentry = models.ForeignKey(LogbookEntry)
|
logbook_entry = models.ForeignKey(LogbookEntry)
|
||||||
is_logbookentryauthor = models.BooleanField()
|
is_logbook_entry_author = models.BooleanField()
|
||||||
|
|
||||||
def __str__(self):
|
def __unicode__(self):
|
||||||
return "%s %s (%s)" % (self.personexpedition, self.place, self.date)
|
return "%s %s (%s)" % (self.person_expedition, self.place, self.date)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, tu):
|
|||||||
lbo.save()
|
lbo.save()
|
||||||
print "ttt", date, place
|
print "ttt", date, place
|
||||||
for tripperson in trippersons:
|
for tripperson in trippersons:
|
||||||
pto = models.PersonTrip(personexpedition = tripperson, place=place, date=date, timeunderground=(tu or ""),
|
pto = models.PersonTrip(person_expedition = tripperson, place=place, date=date, time_underground=(tu or ""),
|
||||||
logbookentry=lbo, is_logbookentryauthor=(tripperson == author))
|
logbook_entry=lbo, is_logbook_entry_author=(tripperson == author))
|
||||||
pto.save()
|
pto.save()
|
||||||
|
|
||||||
def ParseDate(tripdate, year):
|
def ParseDate(tripdate, year):
|
||||||
@ -181,7 +181,8 @@ def Parseloghtmltxt(year, expedition, txt):
|
|||||||
#print "\n", tripcave, "--- ppp", trippeople, len(triptext)
|
#print "\n", tripcave, "--- ppp", trippeople, len(triptext)
|
||||||
ltriptext = re.sub("</p>", "", triptext)
|
ltriptext = re.sub("</p>", "", triptext)
|
||||||
ltriptext = re.sub("\s*?\n\s*", " ", ltriptext)
|
ltriptext = re.sub("\s*?\n\s*", " ", ltriptext)
|
||||||
ltriptext = re.sub("<p>", "\n\n", ltriptext).strip()
EnterLogIntoDbase(date = ldate, place = tripcave, title = triptitle, text = ltriptext, trippeople=trippeople, expedition=expedition, tu=tu)
|
ltriptext = re.sub("<p>", "\n\n", ltriptext).strip()
|
||||||
|
EnterLogIntoDbase(date = ldate, place = tripcave, title = triptitle, text = ltriptext, trippeople=trippeople, expedition=expedition, tu=tu)
|
||||||
|
|
||||||
|
|
||||||
# main parser for pre-2001. simpler because the data has been hacked so much to fit it
|
# main parser for pre-2001. simpler because the data has been hacked so much to fit it
|
||||||
@ -278,6 +279,7 @@ def LoadLogbooks():
|
|||||||
|
|
||||||
# command line run through the loading stages
|
# command line run through the loading stages
|
||||||
# you can comment out these in turn to control what gets reloaded
|
# you can comment out these in turn to control what gets reloaded
|
||||||
LoadExpos()
LoadPersons()
|
LoadExpos()
|
||||||
|
LoadPersons()
|
||||||
LoadLogbooks()
|
LoadLogbooks()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user