Exemple #1
0
def create_nav():
    nav.Bar('main', [
        nav.Item('Übersicht',
                 'backend.dashboard',
                 items=[nav.Item('Dashboard', 'backend.dashboard')]),
        nav.Item('Inhalte',
                 'backend.dashboard',
                 items=[
                     nav.Item("Seiten", 'backend.pages'),
                     nav.Item("News", 'backend.news')
                 ]),
    ])

    navbar_main = nav.bars.__getitem__('main')
    navbar_main_items = navbar_main.items

    # navigationpunkte für admins
    if current_user.is_admin:
        navbar_main_items.append(
            nav.Item('Backend Benutzer',
                     'backend.be_user',
                     items=[
                         nav.Item('Übersicht', 'backend.be_user'),
                         nav.Item('Benutzer hinzufügen', 'backend.add_be_user')
                     ]))

    # navigationspunkte für admins und moderatoren
    if current_user.is_admin or current_user.is_moderator:
        navbar_main_items.append(
            nav.Item('System',
                     'backend.system',
                     items=[
                         nav.Item("Login Versuche",
                                  'backend.failed_login_records'),
                         nav.Item("System Mails", 'backend.system_mails'),
                         nav.Item("Einstellungen", 'backend.system_settings'),
                         nav.Item("Papierkorb", 'backend.trash')
                     ]))

    # navigationspunkt account
    navbar_main_items.append(
        nav.Item(
            'Account',
            '',
            items=[nav.Item("Account bearbeiten", 'backend.account_edit')]))
from app.models import *
from app.tasks.forms import *
from app.tasks.methods import Trello

from flask import render_template, Blueprint, request, redirect, url_for, Response
from uuid import uuid4
from decouple import config
from app import nav
import ast

task = Blueprint('task', __name__, url_prefix='')

nav.Bar('top', [
    nav.Item('Home', 'task.home'),
    nav.Item('Projects', 'task.projects'),
    nav.Item('Actions', 'task.actions'),
    nav.Item('Groups', 'task.groups'),
    nav.Item('Users', 'task.users'),
])


@task.route('/', methods=['GET', 'POST'])
def home():

    user = User.query.all()
    users = len(user)

    data = Project.query.all()
    data = len(data)

    groups = Group.query.all()
import locale

from flask import request, render_template, redirect, url_for, session
from flask_login import current_user, login_required

from app import app, db, nav
from app.models.Goods import Goods
from app.models.Purchase import Purchase
from app.models.PurchaseConsist import PurchaseConsist
from app.models.Users import Users
from app.models.UsersPurchase import UsersPurchase

nav.Bar('top', [
    nav.Item('Главная', 'index'),
    nav.Item(
        'Добавить транзакцию',
        'tr',
        items=[nav.Item('Вручную', 'purchase'),
               nav.Item('По чеку', 'image')]),
    nav.Item('История',
             'nested',
             items=[
                 nav.Item('По транзакциям', 'transactions'),
                 nav.Item('По категориям', 'categorise')
             ]),
])


@app.route('/', methods=['GET', 'POST'])
def index():
    locale.setlocale(locale.LC_ALL, 'ru_RU.UTF-8')
Exemple #4
0
from flask import render_template
from app import nav
from app.home import bp

nav.Bar('top', [nav.Item('Home', 'home.index')])


@bp.route('/')
@bp.route('/index')
def index():
    return render_template('index.html', title='Home')
Exemple #5
0
class MultiEndpointItem(nav.Item):
    def __init__(self, label, endpoint, matching_endpoint_prefixes):
        super(MultiEndpointItem, self).__init__(label, endpoint)
        self.matching_endpoint_prefixes = matching_endpoint_prefixes

    @property
    def is_current(self):
        return any([
            request.endpoint.startswith(pfx)
            for pfx in self.matching_endpoint_prefixes
        ])


nav.Bar('top', [
    nav.Item(_l('nav.home'), 'index'),
    nav.Item(_l('nav.how-it-works'), 'howitworks'),
    MultiEndpointItem(_l('nav.lotse-form'),
                      'login_welcome',
                      matching_endpoint_prefixes=['login_', 'lotse']),
    nav.Item(_l('nav.about-us'), 'contact'),
])

# Multistep flows


@app.route('/eligibility/step/<step>', methods=['GET', 'POST'])
def eligibility(step):
    flow = EligibilityMultiStepFlow(endpoint='eligibility')
    return flow.handle(step_name=step)
Exemple #6
0
from flask import render_template, url_for, redirect
from app import app, nav, db, EmailForm, EmailList

# Navigation bars
nav.Bar(
    'nav',
    [
        nav.Item('Home', 'home')
        # nav.Item('FAQ', 'faq'),
        # nav.Item('About', 'about')
    ])


@app.route('/', methods=['GET', 'POST'])
def home():
    form = EmailForm()

    if form.validate_on_submit():
        dat = {'email': form.email.data}
        email = EmailList.create(**dat)

        return redirect(url_for('access'))

    return render_template('home.html', form=form)


@app.route('/access')
def access():
    return render_template('access.html')

Exemple #7
0
from flask import render_template
from app import nav
from app.main import bp

nav.Bar('top', [
    nav.Item('Dashboard', 'main.index'),
    nav.Item('Project', 'project.projects'),
    nav.Item('Device', 'device.devices'),
    nav.Item('Applications', 'apk.applications'),
    nav.Item('About', 'main.about')
])


@bp.route('/', methods=['GET', 'POST'])
@bp.route('/index', methods=['GET', 'POST'])
def index():
    return render_template('index.html', title='Home')


@bp.route('/about')
def about():
    return render_template('about.html', title='About')
from werkzeug.utils import secure_filename
from werkzeug.security import generate_password_hash
from datetime import datetime
from pathlib import Path
from csv import reader, writer
from zipfile import ZipFile
from pytz import utc, timezone
from os import remove
from io import StringIO

logging.basicConfig(filename=Path(app.config['ROOT_PATH'], 'info.log'),
                    level=logging.INFO,
                    format=f'{datetime.utcnow()}, %(levelname)s, %(message)s')

nav.Bar('top', [
    nav.Item('Dashboard', 'teachers'),
    nav.Item('Enter Student', 'manualentry'),
    nav.Item('Student Lookup', 'studentReport'),
    nav.Item('Teacher Settings', 'teacherSettings'),
    nav.Item('Admin Settings', 'adminSettings'),
    nav.Item('Logout', 'logout')
])


@app.context_processor
def customSettings():
    return getSettings()


@app.route('/')
def public():