mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
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:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user