Add selector field to Admin's Upload Page

This commit is contained in:
Michel V 2020-06-29 14:01:25 +02:00
parent 0df1db25ae
commit ab40850816
4 changed files with 4 additions and 11 deletions

View File

@ -1,3 +0,0 @@
FLASK_APP=Pycloud.py
FLASK_ENV=development
SECRET_KEY='key'

View File

@ -2,11 +2,7 @@ Packages:
python3
virtualenv
on Virtual environment
python-dotenv
flask
flask-wtf
flask-sqlalchemy
flask-migrate
python-dotenv, flask, flask-wtf, flask-sqlalchemy, flask-migrate, flask-login
- - How to install your 'Pycloud' with development environment:
- Install python3 (need python3 in PATH, you can download Python on the Website and check the 'add to PATH') and virtualenv ('pip3 install virtualenv').

View File

@ -15,7 +15,7 @@ def updatedata(username):
folder = os.path.join(app.config['FILES_DIR'], user.username)
files = listdir(folder)
for f in files:
filetodb = File(name = f, user = user, folder=folder)
filetodb = File(name = f, user = user, folder=user.username)
db.session.add(filetodb)
db.session.commit()

View File

@ -132,7 +132,7 @@ def view():
return render_template('view.html', title=words['nameView'], dico=words, userlogged=current_user, users = User.query.all())
files = []
for filefromdb in File.query.all():
if filefromdb.user == current_user:
if filefromdb.folder == current_user.username:
files.append(filefromdb)
if not len(files):
flash(words['ErrorNoFiles'])
@ -157,7 +157,7 @@ def viewAdmin(id):
return redirect(url_for('home'))
files = []
for filefromdb in File.query.all():
if filefromdb.user == user:
if filefromdb.folder == user.username:
files.append(filefromdb)
if not len(files):
flash(words['ErrorNoFiles'])