def getNumRegistered(self, includeTemporaryRegs=False, dateTime=None):
count = self.eventregistration_set.filter(cancelled=False,dropIn=False).count()<EOL>if includeTemporaryRegs:<EOL><INDENT>excludes = Q(registration__expirationDate__lte=timezone.now())<EOL>if isinstance(dateTime,datetime):<EOL><INDENT>excludes = exclude | Q(registration__dateTime__gte=dateTime)<EOL><DEDENT>count += self.temporaryeventregistration_set.filter(dropIn=False).exclude(excludes).count()<EOL><DEDENT>return count<EOL>
Method allows the inclusion of temporary registrations, as well as exclusion of
temporary registrations that are too new (e.g. for discounts based on the first
X registrants, we don't want to include people who started tp register later
than the person in question.