From 0d68ce23887f52481b61d1934c85520e2dbb3d66 Mon Sep 17 00:00:00 2001 From: Johnson Chetty Date: Wed, 15 Aug 2012 21:32:08 +0200 Subject: [PATCH] added fields to models, and an sqldiff, unstable tho.. --- itf/itfprofiles/admin.py | 4 ++++ itf/itfprofiles/forms.py | 1 - itf/itfprofiles/models.py | 15 ++++++++----- .../modules/itfprofiles/theatregroup.html | 22 ++++++++++++++++++- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/itf/itfprofiles/admin.py b/itf/itfprofiles/admin.py index c6f52cf..9bd73a7 100755 --- a/itf/itfprofiles/admin.py +++ b/itf/itfprofiles/admin.py @@ -35,9 +35,13 @@ class OccupationAdmin(admin.ModelAdmin): class RelationAdmin(admin.ModelAdmin): save_on_top = True +class TheatreGroupAdmin(admin.ModelAdmin): + save_on_top = True + admin.site.register(Occupation, OccupationAdmin) admin.site.register(Relation, RelationAdmin) +admin.site.register(TheatreGroup, TheatreGroupAdmin) admin.site.register(Person) #class TalkAdmin(admin.ModelAdmin): # inlines = [PadmaVideoInline, AudioInline, ImageInline, DocumentInline] diff --git a/itf/itfprofiles/forms.py b/itf/itfprofiles/forms.py index 2722f66..095e065 100644 --- a/itf/itfprofiles/forms.py +++ b/itf/itfprofiles/forms.py @@ -176,4 +176,3 @@ class ItfRegistrationForm(RegistrationForm): new_profile = ItfProfile(user=new_user, subscribed=self.cleaned_data['subscribe']) new_profile.save() return new_user - diff --git a/itf/itfprofiles/models.py b/itf/itfprofiles/models.py index eaa7e91..1a6fb74 100644 --- a/itf/itfprofiles/models.py +++ b/itf/itfprofiles/models.py @@ -197,6 +197,7 @@ class Training(models.Model): where = models.ForeignKey("TheatreGroup") from_when = models.DateField(blank=True, null=True) until_when = models.DateField(blank=True, null=True) + locations = generic.GenericRelation("Location") class Play(ItfModel): @@ -267,7 +268,7 @@ class TheatreGroup(ItfModel): # location = models.ForeignKey(Location, blank=True, null=True, related_name="theatregroup_location") tel = models.IntegerField(blank=True, null=True) # -- FIXME tel = models.CharField(blank=True, null=True) - nature_of_work = models.ManyToManyField("GroupOccupation", blank=True, null=True, through="GroupGroupOccupation") + languages = models.ManyToManyField("Language", blank=True, null=True) year_founded = models.IntegerField(blank=True, null=True) about = models.TextField(blank=True) @@ -277,11 +278,12 @@ class TheatreGroup(ItfModel): # resources = models.ManyToManyField("Resource", blank=True, null=True) locations = generic.GenericRelation("Location"), # locations = models.ManyToManyField("Location", blank=True, null=True, related_name="theatregroup_locations") - + nature_of_work = models.ManyToManyField("GroupOccupation", blank=True, null=True, through="GroupGroupOccupation") about = models.TextField(blank=True, null=True) - nature_of_work = models.CharField(max_length=255) + #nature_of_work = models.CharField(max_length=255) founded = models.CharField(max_length=10) - + trainings = models.ManyToManyField("Training", blank=True, null=True) + def __unicode__(self): return self.name @@ -292,8 +294,9 @@ class TheatreGroup(ItfModel): 'about': self.about, 'email': self.email, 'tel':self.tel, - 'nature_of_work': [ obj for obj in self.nature_of_work_set.all()], - 'venues': [obj for obj in self.locations_set.alll()] + 'nature_of_work': [ obj for obj in self.nature_of_work.all().order_by('groupgroupoccupation__is_main')], + 'venues': [obj for obj in self.locations], + #'trainings': [obj for obj in self.trainings_set.all()] } def get_title(self): diff --git a/itf/templates/modules/itfprofiles/theatregroup.html b/itf/templates/modules/itfprofiles/theatregroup.html index 5ee95b6..837152c 100644 --- a/itf/templates/modules/itfprofiles/theatregroup.html +++ b/itf/templates/modules/itfprofiles/theatregroup.html @@ -3,16 +3,36 @@
+ A brief bio and a history of work. should be able to add photos here + {% if about %} +
+ {{ about }} +
+ {% endif %} + + + + {% if nature_of_work %} +
+ {% for work in nature_of_work %} + + {{ work }} : {{ work.is_main }} + + {% endfor %} +
+ {% endif %} +
+
Active Members, Associates, (Fans? - maybe this is a link with a list popout, so they are not perceived as internal to the group). Photos of users on site should show up. We must SEE the community. Noel needs to send a design for tha tab, which will be used across all "People" tabs.