Exemplo n.º 1
0
 def processButton(self):
     ordernum = self.txtprocess.text()
     status = self.txtnew.text()
     admin = Admin()
     r = admin.processorder(ordernum, status)
     if r:
         self.showMessage("Order processed.")
     else:
         self.showMessage("Failed to process.")
Exemplo n.º 2
0
def login_admin():
    if request.method == 'POST':
        email = request.form['email']
        password = request.form['password']
        if Admin.is_login_valid(email, password):
            session['email'] = email
            return redirect(url_for('admin.index'))
        else:
            return redirect(url_for('login_admin'))
    return render_template('login.html')
Exemplo n.º 3
0
def adminsignup():
    form = SignupForm()

    if request.method == 'POST':
        if form.validate() == False:
            return render_template('adminsignup.html', form=form)
        else:
            newadmin = Admin(form.first_name.data, form.last_name.data,
                             form.email.data, form.password.data)
            db.session.add(newadmin)
            db.session.commit()

            return "Admin SignUp Success!"  ##Change to more suitable page
    elif request.method == 'GET':
        return render_template('adminsignup.html', form=form)
Exemplo n.º 4
0
    def on_radio_button_clicked(self):
        Administration = Admin()
        date1 = self.txtdate1.text()
        date2 = self.txtdate2.text()

        if self.r1.isChecked():
            r = Administration.mostsold(date1, date2)
        elif self.r2.isChecked():
            r = Administration.mostsold2(date1, date2)
        elif self.r3.isChecked():
            r = Administration.ten_customer(date1, date2)
        elif self.r4.isChecked():
            r = Administration.five_zip(date1, date2)
        elif self.r5.isChecked():
            r = Administration.avg_price(date1, date2)

        msg = tupleMsg(r)
        self.showMessage(msg)
Exemplo n.º 5
0
def add():
    pwd = generate_password_hash('123')
    a = Admin(name='ljj', pass_hash=pwd)
    apps.db.session.add(a)
    return 'ok'
Exemplo n.º 6
0
 def lookupButton(self):
     status = self.txtview.text()
     admin = Admin()
     r = admin.viewbystatus(status)
     self.showMessage(tupleMsg(r))
Exemplo n.º 7
0
def add():
    pwd = generate_password_hash('lhr666666')

    a = Admin(name='lhr', pass_hash=pwd)
    apps.db.session.add(a)
    return 'addok'
Exemplo n.º 8
0
from flask import Blueprint, Flask, render_template, abort
from jinja2 import TemplateNotFound
from flask import Flask, render_template, request, redirect, url_for, session
import os
import collections

from database import AdminUniversity, Admin

university = AdminUniversity()
admin = Admin()

Admin = Blueprint('admin',
                  __name__,
                  template_folder=os.path.join(os.getcwd(), 'admin'))


@Admin.route('/login', methods=['GET', 'POST'])
def login():
    if session.get('logged_in', None):
        return redirect(url_for('admin.dataUpload'))

    if request.method == 'POST':
        email = request.form['txtEmail']
        psw = request.form['txtPwd']

        status = admin.admin_login(email, psw)

        if not status:
            return render_template('login.html', msg='Login failed')
        else:
            return redirect(url_for('admin.dataUpload'))