Ejemplo n.º 1
0
def index():
    about = About.get_master_db()
    about_info = about.short_info

    galleries = Gallery.query(Gallery.is_public==True).order(-Gallery.created)
    images = []
    for gallery in galleries:
        for img in gallery.images:
            if len(images) >= 4:
                break
            images.append(img)

    excursions = ExcursionType.query(ExcursionType.is_public == True).count()
    hotels = Region.query(Region.is_public == True).count()
    exhibition_info = ExhibitionInfo.get_master_db().is_public
    investments = InvestmentInfo.get_master_db().is_public
    tenancy = TenancyInfo.get_master_db().is_public
    coach = CoachInfo.get_master_db().is_public
    soc_widgets = SocWidget.query(SocWidget.is_public == True)

    return render_template(
        'main_page/index.html',
        html_class='main_page',
        about=about_info,
        gallery=images,
        hotels=hotels,
        exhibition_info=exhibition_info,
        excursions=excursions,
        investments=investments,
        tenancy=tenancy,
        coach=coach,
        soc_widgets=soc_widgets
    )
Ejemplo n.º 2
0
def index():
    widgets = SocWidget.query()
    form = SocWidgetForm()
    if form.validate_on_submit():
        soc_widget = SocWidget()
        form.populate_obj(soc_widget)
        soc_widget.put()
        return redirect(url_for('soc_widget.admin.index'))
    return render_template(
        'soc_widget/admin/index.html',
        form=form,
        widgets=widgets
    )