def create_new_skype_event(): user_presenter = User.objects.create_user("alamin", "*****@*****.**") user_attendee = User.objects.create_user( "alamin2", "*****@*****.**") event = Event(title="test_event") event.presenter = user_presenter event.content_type = 'skype_session' event.start_time = timezone.now() + timedelta(hours=48) event.end_time = event.start_time + timedelta(hours=1) event.save() Registration.objects.create(event=event, attendee=user_attendee, skype_id="skype_id") return event
def create_new_skype_event(): user_presenter = User.objects.create_user("alamin", "*****@*****.**") user_attendee = User.objects.create_user("alamin2", "*****@*****.**") event = Event(title="test_event") event.presenter = user_presenter event.content_type = 'skype_session' event.start_time = timezone.now() + timedelta(hours=48) event.end_time = event.start_time + timedelta(hours=1) event.save() Registration.objects.create(event=event, attendee=user_attendee, skype_id="skype_id") return event
def load_events(): """ Goes through the events for each program and creates or updates events as necessary using the data from the event_data dictionary """ for post, program_id in NAClient().get_events(): if post['status'] == "published": try: post_parent_program = get_program(program_id) parent_program_events_homepage = get_content_homepage( post_parent_program, ProgramEventsPage, 'Events', ) event_slug = slugify(post['title']) new_event = Event.objects.filter(slug=event_slug).first() event_data = get_event_data(post) if not new_event and event_slug: new_event = Event( search_description='', seo_title='', depth=5, show_in_menus=False, slug=event_slug, title=post['title'], subheading=post['sub_headline'], date=event_data['date'], end_date=event_data['end_date'], start_time=event_data['start_time'], end_time=event_data['end_time'], host_organization=event_data['host_organization'], street_address=event_data['street_address'], city=event_data['city'], state=event_data['state'], zipcode=event_data['zipcode'], rsvp_link=event_data['rsvp_link'], body=json.dumps([{ 'type': 'paragraph', 'value': post['content'] }]), soundcloud_url=post['soundcloud_url'], story_image=download_image(post['cover_image_url'], event_slug + "_image.jpeg"), story_excerpt=get_summary(post['summary']), ) parent_program_events_homepage.add_child( instance=new_event) new_event.save() connect_programs_to_post(new_event, post['programs']) elif new_event and event_slug and need_to_update_post( post['modified']): new_event.search_description = '' new_event.seo_title = '' new_event.depth = 5 new_event.date = event_data['date'] new_event.end_date = event_data['end_date'] new_event.start_time = event_data['start_time'] new_event.end_time = event_data['end_time'] new_event.host_organization = event_data[ 'host_organization'] new_event.street_address = event_data['street_address'] new_event.city = event_data['city'] new_event.state = event_data['state'] new_event.zipcode = event_data['zipcode'] new_event.rsvp_link = event_data['rsvp_link'] new_event.show_in_menus = False new_event.slug = event_slug new_event.title = post['title'] new_event.subheading = post['sub_headline'] new_event.body = json.dumps([{ 'type': 'paragraph', 'value': post['content'] }]) new_event.story_image = download_image( post['cover_image_url'], event_slug + "_image.jpeg") new_event.story_excerpt = get_summary(post['summary']) new_event.soundcloud_url = post['soundcloud_url'] new_event.save() connect_programs_to_post(new_event, post['programs']) except django.db.utils.IntegrityError: pass