From 88e286d66ae40091a68b76ddcfabef87e82526ec Mon Sep 17 00:00:00 2001 From: Johnson Chetty Date: Fri, 31 Aug 2012 21:37:20 +0200 Subject: [PATCH] get_dict for Person done v1.0 --- itf/itfprofiles/models.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/itf/itfprofiles/models.py b/itf/itfprofiles/models.py index 6b694cb..9eac718 100644 --- a/itf/itfprofiles/models.py +++ b/itf/itfprofiles/models.py @@ -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")