Add selector field to Admin's Upload Page
This commit is contained in:
parent
0df1db25ae
commit
ab40850816
6
Need.txt
6
Need.txt
|
@ -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').
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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'])
|
||||
|
|
Loading…
Reference in New Issue