def getListForEvent(self, event=None):
names = list(self.guestlistname_set.annotate(<EOL>guestType=Case(<EOL>When(notes__isnull=False, then=F('<STR_LIT>')),<EOL>default=Value(ugettext('<STR_LIT>')),<EOL>output_field=models.CharField()<EOL>)<EOL>).values('<STR_LIT>','<STR_LIT>','<STR_LIT>'))<EOL>components = self.guestlistcomponent_set.all()<EOL>filters = Q(pk__isnull=True)<EOL>for component in components:<EOL><INDENT>if event and self.appliesToEvent(event):<EOL><INDENT>filters = filters | self.getComponentFilters(component,event=event)<EOL><DEDENT>else:<EOL><INDENT>filters = filters | self.getComponentFilters(component,dateTime=timezone.now())<EOL><DEDENT><DEDENT>if self.includeStaff and event and self.appliesToEvent(event):<EOL><INDENT>filters = filters | Q(eventstaffmember__event=event)<EOL><DEDENT>names += list(StaffMember.objects.filter(filters).annotate(<EOL>guestType=Case(<EOL>When(eventstaffmember__event=event, then=Concat(Value('<STR_LIT>'), '<STR_LIT>')),<EOL>default=Value(ugettext('<STR_LIT>')),<EOL>output_field=models.CharField()<EOL>)<EOL>).distinct().values('<STR_LIT>','<STR_LIT>','<STR_LIT>'))<EOL>if self.includeRegistrants and event and self.appliesToEvent(event):<EOL><INDENT>names += list(Registration.objects.filter(eventregistration__event=event).annotate(<EOL>guestType=Value(_('<STR_LIT>'),output_field=models.CharField())<EOL>).values('<STR_LIT>','<STR_LIT>','<STR_LIT>'))<EOL><DEDENT>return names<EOL>
Get the list of names associated with a particular event.