Beispiel #1
0
 def init_db(self):
     for param in PARAMS:
         if ParamApp.get(param) is None:
             db.session.add(ParamApp(key=param, value=''))
             db.session.commit()
             current_app.logger.info(
                 "create homepage parameter register %s" % param)
Beispiel #2
0
def search():
    return render_template('search.html',
                           listofvalue=getlistofvalue(),
                           suits=[],
                           location=request.form.get('location', ''),
                           gender=request.form.get('gender', ''),
                           element=request.form.get('elt', ''),
                           size=request.form.get('size', ''),
                           epoque=request.form.get('epoque', ''),
                           state=request.form.get('state', ''),
                           color=request.form.get('color', ''),
                           dispo=request.form.get('dispo', ''),
                           description=request.form.get('description', ''),
                           titlehome=ParamApp.getValue('titlehome'),
                           bannerhome=ParamApp.getValue('bannerhome'))
Beispiel #3
0
def getlistofvalue():
    params = {}
    for param in LISTOFVALUE:
        params[param] = ParamApp.getValue(param).split(';')
    params['translate'] = int((
        max([int(size)
             for size in ParamApp.getValue('sizecamera').split('x')]) -
        min([int(size)
             for size in ParamApp.getValue('sizecamera').split('x')])) / 2)
    params['translatepreview'] = int((max(
        [int(size)
         for size in ParamApp.getValue('sizepreview').split('x')]) - min([
             int(size) for size in ParamApp.getValue('sizepreview').split('x')
         ])) / 2)
    return params
Beispiel #4
0
def view_user(id):
    try:
        user = User.query.filter_by(id=id).first()
        if user is not None:
            return render_template(
                'user.html',
                user=user,
                backurl="/users",
                locations=ParamApp.getValue('location').split(';'))
        else:
            raise ('user not found')
    except:
        flash('Not user identified', 'error')
        return render_template(
            'user.html',
            user=current_user,
            backurl=None,
            locations=ParamApp.getValue('location').split(';'))
Beispiel #5
0
def view():
    params = {}
    for param in PARAMS:
        params[param] = ParamApp.getValue(param)
    params['APP_DESC'] = current_app.config.get("APP_DESC", "")
    params['APP_NAME'] = current_app.config.get("APP_NAME", "")
    params['APP_VERSION'] = current_app.config.get("VERSION", "")
    params['APP_HOST'] = current_app.config.get("APP_HOST", "")
    params['APP_PORT'] = current_app.config.get("APP_PORT", "")
    params['APP_DEBUG'] = current_app.config.get("APP_DEBUG", "")
    params['APP_DIR'] = current_app.config.get("APP_DIR", "")
    return render_template('paramapp.html', **params)
Beispiel #6
0
def update():
    for param in PARAMS:
        paramregister = ParamApp.get(param)
        paramregister.value = request.form.get(param, '')
        paramregister.save()

    file = request.files['file']
    if file:
        filename = secure_filename(file.filename)
        pathfile = os.path.join(current_app.config['APP_IMG'],
                                unidecode.unidecode(filename))
        file.save(pathfile)
    return redirect(url_for('homepage.view'))
Beispiel #7
0
def searchsuits():
    if request.form.get('update', 'no') == 'no':
        kw = {
            key: request.form[key]
            for key in request.form if request.form.get(key, '') != ''
            and key not in ['update', 'description']
        }
        suits = Suit.query.filter_by(**kw).all()
        if request.form.get('description', '') != '':
            elts = [elt for elt in request.form if elt != 'update']
            suitsorts = [
                SuitSort(suit, request.form.get('description', ''), elts)
                for suit in suits
            ]
            suitsorts.sort(reverse=True)
            suits = [
                suitsort.suit for suitsort in filter(onlyFound, suitsorts)
            ]
    else:
        suits = []
    return render_template('search.html',
                           listofvalue=getlistofvalue(),
                           suits=suits[0:int(ParamApp.getValue('limit'))],
                           location=request.form.get('location', ''),
                           gender=request.form.get('gender', ''),
                           element=request.form.get('element', ''),
                           size=request.form.get('size', ''),
                           epoque=request.form.get('epoque', ''),
                           state=request.form.get('state', ''),
                           color=request.form.get('color', ''),
                           dispo=request.form.get('dispo', ''),
                           haut=request.form.get('haut', ''),
                           robe=request.form.get('robe', ''),
                           ensemble=request.form.get('ensemble', ''),
                           accessoire=request.form.get('accessoire', ''),
                           description=request.form.get('description', ''),
                           titlehome=ParamApp.getValue('titlehome'),
                           bannerhome=ParamApp.getValue('bannerhome'))
Beispiel #8
0
def update():
    for param in PARAMS:
        paramregister = ParamApp.get(param)
        paramregister.value = request.form.get(param, '')
        paramregister.save()
    return redirect(url_for('paramapplication.view'))
Beispiel #9
0
def view():
    params = {}
    for param in PARAMS:
        params[param] = ParamApp.getValue(param)
    return render_template('homepage.html', **params)
Beispiel #10
0
def new_user():
    return render_template('user.html',
                           user=User(),
                           backurl="/users",
                           locations=ParamApp.getValue('location').split(';'))
Beispiel #11
0
def currentuser():
    return render_template('user.html',
                           user=current_user,
                           backurl=None,
                           locations=ParamApp.getValue('location').split(';'))