def management(): """ This endpoint is for vieweing and adding users and clients. """ if request.method == 'POST' and request.form['submit'] == 'Add User': User.save(request.form['username'], request.form['password']) if request.method == 'POST' and request.form['submit'] == 'Add Client': Client.generate() return render_template('management.html', users=User.all(), clients=Client.all())
def management(): """Provides a quick management screen for users, clients and tokens.""" if request.method == 'POST' and request.form['submit'] == 'Add User': # Create a new user if the 'Add User' form has been sent. User.save(request.form['username'], request.form['password']) if request.method == 'POST' and request.form['submit'] == 'Add Client': # Create a new client if the 'Add Client' form has been sent. Client.generate() # Show the management page. return render_template( 'management.html', users=User.all(), clients=Client.all(), tokens=Token.all() )
def getClient(self, shortCode, createNew = False): return Client.all().filter('shortCode =', shortCode).get()
def getClient(self, shortCode, createNew=False): return Client.all().filter('shortCode =', shortCode).get()
def management(): if request.method == 'POST' and request.form['submit'] == 'Add Client': Client.generate() return render_template('management.html', clients=Client.all())
def list_clients(): clients = Client.all() clients_new = [] for client in clients: clients_new.append(client.serialize()) return make_response(jsonify(clients_new), status.HTTP_200_OK)