get_dict for Person done v1.0

This commit is contained in:
Johnson Chetty 2012-08-31 21:37:20 +02:00
parent ff22815bac
commit 88e286d66a

View File

@ -24,7 +24,6 @@ class Person(ItfModel):
first_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
email = models.EmailField(blank=True, null=True, unique=True, db_index=True)
# email_validated = models.BooleanField(default=False, editable=False) #s commented this out since its handled by allauth
tel_no = models.CharField(max_length=100, blank=True)
about = models.TextField(blank=True, null=True)
dob = models.DateField(null=True, verbose_name="Date of Birth", blank=True)
@ -67,11 +66,33 @@ class Person(ItfModel):
return self.__unicode__()
def get_dict(self):
#lconnections = [obj for obj in self.connections.all()]
#rconnections = [ obj for obj in PersonPerson.objects.filter(person2=self)
return {
'first_name': self.first_name,
'last_name': self.last_name,
'about': self.about
}
'about': self.about,
'user': self.user,
'tel_no': self.tel_no,
'about':self.about,
'dob':self.dob,
'is_practioner':self.is_practioner,
'is_enthusiast':self.is_enthusiast,
'is_freelancer': self.is_freelancer,
'occupations': [ obj for obj in self.occupations.all()],
'gender':self.gender,
'image':self.image,
'locations': [obj for obj in self.locations.all()],
'groups': [obj for obj in self.groups.all()],
'connections': [obj for obj in self.PersonFrom.all()] + [obj for obj in self.PersonTo.all() ],
'productions': [ obj for obj in self.productions.all()],
'trainings': [ obj for obj in self.trainings.all()],
'languages': [ obj for obj in self.languages.all()],
'awards': [ obj for obj in self.awards.all()],
'buzzitems': [ obj for obj in self.buzzitems.all()],
}
OCCUPATION_TYPES = (
('practitioner', 'Practitioner'),
@ -232,7 +253,7 @@ class TheatreGroup(ItfModel):
awards = generic.GenericRelation("Award")
buzzitems = generic.GenericRelation("BuzzItem")
website = models.URLField(blank=True, verify_exists=False)
resources = models.ManyToManyField("Resource", blank=True, null=True)
resources = models.ManyToManyField("Resource", blank=True, null=True)
locations = generic.GenericRelation("Location")
# albums = generic.GenericRelation(Album)
nature_of_work = models.ManyToManyField("GroupOccupation", blank=True, null=True, through="GroupGroupOccupation")