コード例 #1
0
ファイル: person.py プロジェクト: tracon/kompassi
    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)
コード例 #2
0
ファイル: person.py プロジェクト: Archinowsk/kompassi
    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)
コード例 #3
0
ファイル: signup.py プロジェクト: Kriivari/kompassi
    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)
コード例 #4
0
ファイル: signup.py プロジェクト: jlaunonen/kompassi
    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)
コード例 #5
0
ファイル: programme.py プロジェクト: jlaunonen/kompassi
    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)
コード例 #6
0
ファイル: programme.py プロジェクト: wizzu/kompassi
    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)
コード例 #7
0
    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
コード例 #8
0
 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 ''