2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-01-31 15:32:35 +00:00

[svn] Generalised the way dates are stored, and added a personRole and Role field

Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8079 by julian @ 11/8/2008 11:27 PM
This commit is contained in:
substantialnoninfringinguser 2009-05-13 05:21:39 +01:00
parent 5757df28a1
commit 469a520e5c

View File

@ -1,17 +1,32 @@
from django.db import models
class SurvexBlock(models.Model):
name = models.CharField(max_length=100, blank=True, null=True)
parent = models.ForeignKey('SurvexBlock', blank=True, null=True)
text = models.TextField()
date = models.DateField(blank=True, null=True)
notes_person = models.ManyToManyField('PersonTrip', related_name="notes", blank=True, null=True)
pics_person = models.ManyToManyField('PersonTrip', related_name="pics", blank=True, null=True)
tape_person = models.ManyToManyField('PersonTrip', related_name="tape", blank=True, null=True)
insts_person = models.ManyToManyField('PersonTrip', related_name="insts", blank=True, null=True)
start_year = models.IntegerField(blank=True, null=True)
start_month = models.IntegerField(blank=True, null=True)
start_day = models.IntegerField(blank=True, null=True)
end_year = models.IntegerField(blank=True, null=True)
end_month = models.IntegerField(blank=True, null=True)
end_day = models.IntegerField(blank=True, null=True)
person = models.ManyToManyField('Person', through='PersonRole', blank=True, null=True)
begin_file = models.CharField(max_length=200)
begin_char = models.IntegerField()
end_file = models.CharField(max_length=200, blank=True, null=True)
end_char = models.IntegerField(blank=True, null=True)
def __unicode__(self):
return unicode(self.name)
class PersonRole(models.Model):
person = models.ForeignKey('Person')
survex_block = models.ForeignKey('SurvexBlock')
role = models.ForeignKey('Role')
def __unicode__(self):
return unicode(self.person) + " - " + unicode(self.survex_block) + " - " + unicode(self.role)
class Role(models.Model):
name = models.CharField(max_length=50)
def __unicode__(self):
return unicode(self.name)