Moved the table element from the main rigboard out to something reusuable.

Added the ability to view organisations by people and vice versa, as well as the option to see all the rigs associated with orgs/people/venues.

Added helper properties for the above
This commit is contained in:
Tom Price
2015-01-22 20:48:37 +00:00
parent e2d01cc6c5
commit c6aed3db75
7 changed files with 200 additions and 119 deletions

View File

@@ -52,6 +52,18 @@ class Person(models.Model, RevisionMixin):
string += "*"
return string
@property
def organisations(self):
o = []
for e in self.event_set.all():
if e.organisation and e.organisation not in o:
o.append(e.organisation)
return o
@property
def latest_events(self):
return self.event_set.order_by('-start_date')
class Meta:
permissions = (
('view_person', 'Can view Persons'),
@@ -75,6 +87,18 @@ class Organisation(models.Model, RevisionMixin):
string += "*"
return string
@property
def persons(self):
p = []
for e in self.event_set.all():
if e.person and e.person not in p:
p.append(e.person)
return p
@property
def latest_events(self):
return self.event_set.order_by('-start_date')
class Meta:
permissions = (
('view_organisation', 'Can view Organisations'),
@@ -131,6 +155,10 @@ class Venue(models.Model, RevisionMixin):
string += "*"
return string
@property
def latest_events(self):
return self.event_set.order_by('-start_date')
class Meta:
permissions = (
('view_venue', 'Can view Venues'),