本文整理汇总了Python中programme.models.ProgrammeEventMeta.get_or_create_group方法的典型用法代码示例。如果您正苦于以下问题:Python ProgrammeEventMeta.get_or_create_group方法的具体用法?Python ProgrammeEventMeta.get_or_create_group怎么用?Python ProgrammeEventMeta.get_or_create_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类programme.models.ProgrammeEventMeta
的用法示例。
在下文中一共展示了ProgrammeEventMeta.get_or_create_group方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from programme.models import ProgrammeEventMeta [as 别名]
# 或者: from programme.models.ProgrammeEventMeta import get_or_create_group [as 别名]
def handle(*args, **options):
if options['test']:
print 'Setting up concon9 in test mode'
else:
print 'Setting up concon9 in production mode'
tz = tzlocal()
venue, unused = Venue.objects.get_or_create(
name=u'Metropolia AMK Hämeentie',
defaults=dict(
name_inessive=u'Metropolia AMK:n Hämeentien toimipisteessä'
)
)
room_order = 0
for room_name in [
u'Zeus',
u'Athene',
]:
room_order += 100
Room.objects.get_or_create(
venue=venue,
name=room_name,
defaults=dict(
order=room_order,
)
)
event, unused = Event.objects.get_or_create(slug='concon9', defaults=dict(
name='Concon 9',
name_genitive='Concon 9 -seminaarin',
name_illative='Concon 9 -seminaariin',
name_inessive='Concon 9 -seminaarissa',
homepage_url='http://concon.nakkikone.org',
organization_name='Yliopiston anime ja manga ry',
organization_url='http://yama.animeunioni.org',
start_time=datetime(2014, 5, 24, 10, 0, tzinfo=tz),
end_time=datetime(2014, 5, 24, 18, 0, tzinfo=tz),
venue=venue,
))
admin_group, unused = ProgrammeEventMeta.get_or_create_group(event=event, suffix='admins')
programme_event_meta, unused = ProgrammeEventMeta.objects.get_or_create(event=event, defaults=dict(
public=False,
admin_group=admin_group,
))
view, unused = View.objects.get_or_create(
event=event,
name='Ohjelmakartta',
)
view.rooms = Room.objects.filter(venue=venue, public=True)
view.save()
for category_name, category_style in [
(u'Ohjelma', u'anime'),
(u'Tauko', u'muu'),
]:
Category.objects.get_or_create(
event=event,
title=category_name,
defaults=dict(
style=category_style,
)
)
for start_time, end_time in [
(
event.start_time,
event.end_time,
),
]:
TimeBlock.objects.get_or_create(
event=event,
start_time=start_time,
defaults=dict(
end_time=end_time
)
)
# half_hour = event.start_time + timedelta(minutes=30)
# while half_hour < end_time:
# SpecialStartTime.objects.create(
# event=event,
# start_time=half_hour,
# )
# half_hour += timedelta(minutes=60)
示例2: setup_programme
# 需要导入模块: from programme.models import ProgrammeEventMeta [as 别名]
# 或者: from programme.models.ProgrammeEventMeta import get_or_create_group [as 别名]
def setup_programme(self):
from programme.models import (
Category,
Programme,
ProgrammeEventMeta,
Role,
Room,
SpecialStartTime,
TimeBlock,
View,
)
programme_admin_group, unused = ProgrammeEventMeta.get_or_create_group(self.event, 'admins')
programme_event_meta, unused = ProgrammeEventMeta.objects.get_or_create(event=self.event, defaults=dict(
public=False,
admin_group=programme_admin_group,
contact_email='Animeconin ohjelmatiimi <[email protected]>',
))
for room_name in [
u'Konserttisali',
u'Kamarimusiikkisali',
u'Auditorio',
u'Jousisto',
u'Luokka 210',
]:
Room.objects.get_or_create(
venue=self.venue,
name=room_name,
defaults=dict(
order=self.get_ordering_number()
)
)
role, unused = Role.objects.get_or_create(
title=u'Ohjelmanjärjestäjä',
defaults=dict(
is_default=True,
require_contact_info=True,
)
)
for title, style in [
(u'Anime ja manga', u'anime'),
(u'Cosplay', u'cosplay'),
(u'Paja', u'miitti'),
(u'Muu ohjelma', u'muu'),
(u'Kunniavieras', u'rope'),
]:
Category.objects.get_or_create(
event=self.event,
style=style,
defaults=dict(
title=title,
)
)
if self.test:
# create some test programme
Programme.objects.get_or_create(
category=Category.objects.get(title='Anime ja manga', event=self.event),
title='Yaoi-paneeli',
defaults=dict(
description='Kika-kika tirsk',
)
)
for start_time, end_time in [
(
self.event.start_time.replace(hour=10, minute=0),
self.event.start_time.replace(hour=20, minute=0),
),
(
self.event.end_time.replace(hour=10, minute=0),
self.event.end_time,
),
]:
TimeBlock.objects.get_or_create(
event=self.event,
start_time=start_time,
defaults=dict(
end_time=end_time
)
)
SpecialStartTime.objects.get_or_create(
event=self.event,
start_time=self.event.start_time,
)
for view_name, room_names in [
(u'Pääohjelmatilat', [
u'Konserttisali',
u'Kamarimusiikkisali',
u'Auditorio',
u'Jousisto',
u'Luokka 210',
]),
]:
rooms = [Room.objects.get(name__iexact=room_name, venue=self.venue)
#.........这里部分代码省略.........
示例3: setup_programme
# 需要导入模块: from programme.models import ProgrammeEventMeta [as 别名]
# 或者: from programme.models.ProgrammeEventMeta import get_or_create_group [as 别名]
def setup_programme(self):
from programme.models import (
Category,
Programme,
ProgrammeEventMeta,
Role,
Room,
SpecialStartTime,
TimeBlock,
View,
)
programme_admin_group, unused = ProgrammeEventMeta.get_or_create_group(self.event, 'admins')
programme_event_meta, unused = ProgrammeEventMeta.objects.get_or_create(event=self.event, defaults=dict(
public=False,
admin_group=programme_admin_group,
contact_email='Tracon X -ohjelmatiimi <[email protected]>',
))
for room_name in [
u'Iso sali',
u'Pieni sali',
u'Sopraano',
u'Rondo',
u'Studio',
u'Sonaatti 1',
u'Sonaatti 2',
u'Basso',
u'Opus 1',
u'Opus 2',
u'Opus 3',
u'Opus 4',
u'Puistolava',
u'Puisto - Iso miittiteltta',
u'Puisto - Pieni miittiteltta',
u'Puisto - Bofferiteltta',
]:
Room.objects.get_or_create(
venue=self.venue,
name=room_name,
defaults=dict(
order=self.get_ordering_number()
)
)
role, unused = Role.objects.get_or_create(
title=u'Ohjelmanjärjestäjä',
defaults=dict(
is_default=True,
require_contact_info=True,
)
)
for title, style in [
(u'Animeohjelma', u'anime'),
(u'Cosplayohjelma', u'cosplay'),
(u'Miitti', u'miitti'),
(u'Muu ohjelma', u'muu'),
(u'Roolipeliohjelma', u'rope'),
]:
Category.objects.get_or_create(
event=self.event,
style=style,
defaults=dict(
title=title,
)
)
if self.test:
# create some test programme
Programme.objects.get_or_create(
category=Category.objects.get(title='Animeohjelma', event=self.event),
title='Yaoi-paneeli',
defaults=dict(
description='Kika-kika tirsk',
)
)
for start_time, end_time in [
(
datetime(2015, 9, 5, 11, 0, 0, tzinfo=self.tz),
datetime(2015, 9, 6, 1 , 0, 0, tzinfo=self.tz),
),
(
datetime(2015, 9, 6, 9 , 0, 0, tzinfo=self.tz),
datetime(2015, 9, 6, 17, 0, 0, tzinfo=self.tz),
),
]:
TimeBlock.objects.get_or_create(
event=self.event,
start_time=start_time,
defaults=dict(
end_time=end_time
)
)
SpecialStartTime.objects.get_or_create(
event=self.event,
start_time=datetime(2015, 9, 5, 10, 30, 0, tzinfo=self.tz),
)
#.........这里部分代码省略.........
示例4: handle
# 需要导入模块: from programme.models import ProgrammeEventMeta [as 别名]
# 或者: from programme.models.ProgrammeEventMeta import get_or_create_group [as 别名]
def handle(*args, **options):
if options['test']:
print 'Setting up kawacon2014 in test mode'
else:
print 'Setting up kawacon2014 in production mode'
tz = tzlocal()
venue, unused = Venue.objects.get_or_create(name='Peltolan ammattiopisto', defaults=dict(
name_inessive='Peltolan ammattiopistolla' # XXX not really inessive
))
room_order = 0
for room_name in [
u'Auditorio',
u'Pääsali',
u'E-rakennus, luokat',
u'Kawaplay, G-rakennus',
u'Elokuvateatteri Tapio',
]:
room_order += 100
Room.objects.get_or_create(
venue=venue,
name=room_name,
defaults=dict(
order=room_order,
)
)
event, unused = Event.objects.get_or_create(slug='kawacon2014', defaults=dict(
name='Kawacon 2014',
name_genitive='Kawacon 2014 -tapahtuman',
name_illative='Kawacon 2014 -tapahtumaan',
name_inessive='Kawacon 2014 -tapahtumassa',
homepage_url='http://kawacon.info',
organization_name='Kawacon ry',
organization_url='http://kawacon.info',
start_time=datetime(2014, 6, 28, 10, 0, tzinfo=tz),
end_time=datetime(2014, 6, 29, 18, 0, tzinfo=tz),
venue=venue,
))
admin_group, unused = ProgrammeEventMeta.get_or_create_group(event=event, suffix='admins')
programme_event_meta, unused = ProgrammeEventMeta.objects.get_or_create(event=event, defaults=dict(
public=False,
admin_group=admin_group,
))
view, unused = View.objects.get_or_create(
event=event,
name='Ohjelmakartta',
)
view.rooms = Room.objects.filter(venue=venue, public=True)
view.save()
for category_name, category_style in [
(u'Luento', u'anime'),
(u'Non-stop', u'miitti'),
(u'Työpaja', u'rope'),
(u'Muu ohjelma', u'muu'),
(u'Show', u'cosplay'),
]:
Category.objects.get_or_create(
event=event,
title=category_name,
defaults=dict(
style=category_style,
)
)
for start_time, end_time in [
(
datetime(2014, 6, 28, 10, 0, 0, tzinfo=tz),
datetime(2014, 6, 28, 18, 0, 0, tzinfo=tz),
),
(
datetime(2014, 6, 29, 10, 0, 0, tzinfo=tz),
datetime(2014, 6, 29, 16, 0, 0, tzinfo=tz),
),
]:
TimeBlock.objects.get_or_create(
event=event,
start_time=start_time,
defaults=dict(
end_time=end_time
)
)