当前位置: 首页>>代码示例>>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;未经允许,请勿转载。