當前位置: 首頁>>代碼示例>>Python>>正文


Python Event.get_or_create_dummy方法代碼示例

本文整理匯總了Python中core.models.Event.get_or_create_dummy方法的典型用法代碼示例。如果您正苦於以下問題:Python Event.get_or_create_dummy方法的具體用法?Python Event.get_or_create_dummy怎麽用?Python Event.get_or_create_dummy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在core.models.Event的用法示例。


在下文中一共展示了Event.get_or_create_dummy方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def get_or_create_dummy(cls):
        from core.models import Event

        event, unused = Event.get_or_create_dummy()
        admin_group, hosts_group = cls.get_or_create_groups(event, ["admins", "hosts"])

        return cls.objects.get_or_create(event=event, defaults=dict(admin_group=admin_group, public=True))
開發者ID:Hilzu,項目名稱:kompassi,代碼行數:9,代碼來源:programme_event_meta.py

示例2: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
 def get_or_create_dummy(cls):
     from core.models import Event
     event, unused = Event.get_or_create_dummy()
     return cls.objects.get_or_create(
         event=event,
         name='Iso sali',
     )
開發者ID:tracon,項目名稱:kompassi,代碼行數:9,代碼來源:room.py

示例3: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def get_or_create_dummy(cls):
        from django.contrib.auth.models import Group
        from core.models import Event

        group, unused = Group.objects.get_or_create(name='Dummy ticket admin group')
        event, unused = Event.get_or_create_dummy()
        return cls.objects.get_or_create(event=event, defaults=dict(admin_group=group))
開發者ID:wyrmiyu,項目名稱:kompassi,代碼行數:9,代碼來源:models.py

示例4: get_or_create_dummies

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def get_or_create_dummies(cls):
        from core.models import Event
        event, unused = Event.get_or_create_dummy()
        jc1, unused = cls.objects.get_or_create(event=event, name="Dummy 1", slug='dummy-1')
        jc2, unused = cls.objects.get_or_create(event=event, name="Dummy 2", slug='dummy-2')

        return [jc1, jc2]
開發者ID:Hilzu,項目名稱:kompassi,代碼行數:9,代碼來源:job_category.py

示例5: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
 def get_or_create_dummy(cls):
     from core.models import Event
     event, unused = Event.get_or_create_dummy()
     admin_group, organizer_group = cls.get_or_create_groups(event, ['admins', 'organizers'])
     return cls.objects.get_or_create(event=event, defaults=dict(
         admin_group=admin_group,
         organizer_group=organizer_group,
     ))
開發者ID:tracon,項目名稱:kompassi,代碼行數:10,代碼來源:intra_event_meta.py

示例6: get_or_create_dummies

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def get_or_create_dummies(cls):
        from core.models import Event
        event, unused = Event.get_or_create_dummy()

        limit_saturday, unused = cls.objects.get_or_create(event=event, description='Testing saturday', defaults=dict(limit=5000))
        limit_sunday, unused = cls.objects.get_or_create(event=event, description='Testing sunday', defaults=dict(limit=5000))

        return [limit_saturday, limit_sunday]
開發者ID:wyrmiyu,項目名稱:kompassi,代碼行數:10,代碼來源:models.py

示例7: test_event_filter

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def test_event_filter(self):
        event, unused = Event.get_or_create_dummy()
        event2, unused = Event.get_or_create_dummy(name='Dummy event 2')

        kwargs = dict(
            channel='callback',
            callback_code=f'{__name__}:notification_callback',
        )

        subscription_with_event_filter, unused = Subscription.get_or_create_dummy(event_filter=event, **kwargs)
        subscription_without_event_filter, unused = Subscription.get_or_create_dummy(event_filter=None, **kwargs)

        entry_type = subscription_with_event_filter.entry_type

        emit(entry_type, event=event)
        emit(entry_type, event=event2)

        assert len(notifications) == 3
開發者ID:Siikakala,項目名稱:kompassi,代碼行數:20,代碼來源:tests.py

示例8: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def get_or_create_dummy(cls, app_label='labour', name='Smallfolk', priority=0):
        from core.models import Event
        event, unused = Event.get_or_create_dummy()

        return PersonnelClass.objects.get_or_create(
            event=event,
            slug=slugify(name),
            app_label=app_label,
            defaults=dict(
                name=app_label,
                priority=priority,
            )
        )
開發者ID:Siikakala,項目名稱:kompassi,代碼行數:15,代碼來源:personnel_class.py

示例9: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def get_or_create_dummy(cls, event=None):
        from django.contrib.auth.models import Group
        from core.models import Event

        if event is None:
            event, unused = Event.get_or_create_dummy()

        group, = PaymentsEventMeta.get_or_create_groups(event, ['admins'])

        return cls.objects.get_or_create(event=event, defaults=dict(
            EVENT_META_DEFAULTS,
            admin_group=group,
        ))
開發者ID:Hilzu,項目名稱:kompassi,代碼行數:15,代碼來源:models.py

示例10: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def get_or_create_dummy(cls):
        from core.models import Event
        from django.utils.timezone import now

        event, unused = Event.get_or_create_dummy()
        admin_group, hosts_group = cls.get_or_create_groups(event, ['admins', 'hosts'])

        return cls.objects.get_or_create(
            event=event,
            defaults=dict(
                admin_group=admin_group,
                public_from=now(),
            )
        )
開發者ID:Siikakala,項目名稱:kompassi,代碼行數:16,代碼來源:programme_event_meta.py

示例11: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def get_or_create_dummy(cls, event=None, title="Dummy survey", **kwargs):
        if event is None:
            from core.models import Event
            event, unused = Event.get_or_create_dummy()

        slug = slugify(title)

        defaults = dict(
            event=event,
            title=title,
            model=dict(),
        )
        defaults.update(kwargs)

        return cls.objects.get_or_create(
            slug=slug,
            defaults=defaults,
        )
開發者ID:tracon,項目名稱:kompassi,代碼行數:20,代碼來源:survey.py

示例12: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
    def get_or_create_dummy(cls, accepted=False):
        from core.models import Person, Event
        from .job_category import JobCategory

        person, unused = Person.get_or_create_dummy()
        event, unused = Event.get_or_create_dummy()
        job_category, unused = JobCategory.get_or_create_dummy()

        signup, created = Signup.objects.get_or_create(person=person, event=event)
        if created:
            signup.job_categories.set([job_category])

        if accepted:
            signup.job_categories_accepted.set(signup.job_categories.all())
            signup.personnel_classes.add(signup.job_categories.first().personnel_classes.first())
            signup.state = 'accepted'
            signup.save()
            signup.apply_state()

        return signup, created
開發者ID:tracon,項目名稱:kompassi,代碼行數:22,代碼來源:signup.py

示例13: get_or_create_dummy

# 需要導入模塊: from core.models import Event [as 別名]
# 或者: from core.models.Event import get_or_create_dummy [as 別名]
 def get_or_create_dummy(cls):
     from core.models import Event
     event, unused = Event.get_or_create_dummy()
     group, = cls.get_or_create_groups(event, ['admins'])
     return cls.objects.get_or_create(event=event, defaults=dict(admin_group=group))
開發者ID:tracon,項目名稱:kompassi,代碼行數:7,代碼來源:badges_event_meta.py


注:本文中的core.models.Event.get_or_create_dummy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。