def index():
    coordinates = (50.814705, 4.381739)
    google_map_location = Map(
        lat=coordinates[0],
        lng=coordinates[1],
        identifier="google_map_location",
        zoom=16,
        style="height:300px;margin:0;",
        markers=[coordinates]
    )

    coordinates = (50.8482509, 4.3540329)
    google_map_leon = Map(
        lat=coordinates[0],
        lng=coordinates[1],
        identifier="google_map_leon",
        zoom=16,
        style="height:300px;margin:0;",
        markers=[coordinates]
    )

    event = Event.current_event()
    talks = list(convert_to_presenter(event.validated_talks, TalkPresenter))

    return render_template('test/index.html',
                           talks=talks,
                           google_map_location=google_map_location,
                           google_map_leon=google_map_leon)
def schedule():
    event = Event.current_event()
    talks = list(convert_to_presenter(event.validated_talks, TalkPresenter))
    subscribe_form = SubscribeForm()
    return render_template('general/schedule.html',
                           talks=talks,
                           subscribe_form=subscribe_form)
    def test_current_event(self):
        with self.app.test_request_context():
            event = Event(
                name='Python FOSDEM 2014',
                start_on=datetime.date(2014, 1, 31),
                stop_on=datetime.date(2014, 2, 2),
                duedate_start_on=datetime.date(2013, 11, 17),
                duedate_stop_on=datetime.date(2013, 12, 15)
            )
            db.session.add(event)

            event = Event(
                name='Python FOSDEM 2013',
                start_on=datetime.date(2013, 1, 31),
                stop_on=datetime.date(2013, 2, 2),
                duedate_start_on=datetime.date(2012, 11, 17),
                duedate_stop_on=datetime.date(2012, 12, 15),
                active=False
            )
            db.session.add(event)
            db.session.commit()

            event = Event.current_event()
            self.assertEqual(event.name, 'Python FOSDEM 2014')
            self.assertEqual(event.start_on, datetime.date(2014, 1, 31))
            self.assertEqual(event.stop_on, datetime.date(2014, 2, 2))
            self.assertEqual(event.duedate_start_on, datetime.date(2013, 11, 17))
            self.assertEqual(event.duedate_stop_on, datetime.date(2013, 12, 15))
            self.assertTrue(event.active)
def index2():
    scheduler_available = True
    if scheduler_available:
        return redirect(url_for('general.schedule'))

    event = Event.current_event()

    dateline_has_reached = datetime.date.today() >= event.duedate_stop_on
    subscribe_form = SubscribeForm()
    return render_template('general/index.html', 
                           dateline_has_reached=dateline_has_reached,
                           scheduler_available=scheduler_available,
                           subscribe_form=subscribe_form,
                           event=event,
                          )
def talk_submit():
    today = datetime.date.today()
    event = Event.current_event()

    if today > event.duedate_stop_on:
        return render_template('general/closed_talk_proposal.html')

    talk = Talk()
    form = TalkProposalForm(obj=talk)

    if form.validate_on_submit():

        talk = Talk(
            name=form.title.data,
            user=current_user,
            description=form.description.data,
            twitter=form.twitter.data,
            level=form.level.data,
            site=form.site_url.data,
            event=event,
        )

        flash(_('Your proposal will be moderated as soon as possible'))

        msg = pythonfosdem.tools.mail_message(
            _('Thank you for your proposal'),
            recipients=[current_user.email],
            templates={'txt': 'emails/send_thank.txt'},
            values=dict(talk=talk)
        )
        mail.send(msg)
        db.session.add(talk)
        db.session.commit()

        return to_index()
    return render_template('general/talk_proposal.html',
                           current_nav_link='general.index',
                           form=form)
def talks_to_validate():
    event = Event.current_event()
    records = event.talks.all()

    return render_template('general/talks_dashboard.html', records=records)
 def run(self):
     event = Event.current_event()
     print event.id, event.name