def apply_state_update_badges(self): if 'badges' not in settings.INSTALLED_APPS: return from badges.models import Badge # Only touch badges for events in the future for badge in self.badges.filter(personnel_class__event__start_time__gte=now()): Badge.ensure(person=self, event=badge.personnel_class.event)
def apply_state_update_badges(self): if 'badges' not in settings.INSTALLED_APPS: return from badges.models import Badge # Only touch badges for events in the future for badge in self.badges.filter( personnel_class__event__start_time__gte=now()): Badge.ensure(person=self, event=badge.personnel_class.event)
def apply_state_create_badges(self): if 'badges' not in settings.INSTALLED_APPS: return if self.event.badges_event_meta is None: return from badges.models import Badge Badge.ensure(event=self.event, person=self.person)
def apply_state_create_badges(self, deleted_programme_roles=[]): if 'badges' not in settings.INSTALLED_APPS: return if self.event.badges_event_meta is None: return from badges.models import Badge for person in self.organizers.all(): Badge.ensure(event=self.event, person=person) for deleted_programme_role in deleted_programme_roles: Badge.ensure(event=self.event, person=deleted_programme_role.person)
def handle(*args, **opts): from programme.models import Programme from core.models import Event from badges.models import Badge for event_slug in args[1:]: event = Event.objects.get(slug=event_slug) for programme in Programme.objects.filter(category__event=event).exclude(state__in=['rejected', 'cancelled']): for person in programme.organizers.all(): try: Badge.ensure(event=event, person=person) print person except Badge.MultipleObjectsReturned: print u'WARNING: Multiple badges for', person
def personnel_class_name(self): from badges.models import Badge badge, unused = Badge.ensure(event=self.event, person=self.person) return badge.personnel_class.name if badge else ''