add upload admins form

This commit is contained in:
tets@test.test
2022-10-24 01:16:52 +03:00
parent 65a52fe64c
commit 46a604054c
3 changed files with 61 additions and 99 deletions

16
app.py
View File

@@ -26,8 +26,6 @@ db.init_app(app)
@app.route("/")
def index():
print(app.config['UPLOAD_FOLDER2'])
print(type(app.config['UPLOAD_FOLDER']))
detals = PrintedDetal.query.all()
return render_template("index.html", detals=detals)
@@ -35,12 +33,17 @@ def index():
@app.route("/admin", methods=['GET', 'POST'])
def admipage():
logging.debug("adminpage loaded")
if request.method == 'POST':
logging.debug("POST QUERY loaded")
image_file = request.files['images']
stl_file = request.files['stl']
logging.debug(image_file)
logging.debug(stl_file)
image_file.save(os.path.join(app.config['UPLOAD_FOLDER'], image_file.filename))
stl_file.save(os.path.join(app.config['UPLOAD_FOLDER2'], stl_file.filename))
@@ -60,6 +63,11 @@ def admipage():
else:
return render_template("adminpage.html")
@app.route('/uploader', methods = ['GET', 'POST'])
def upload_file():
if request.method == 'POST':
f = request.files['file']
f.save(secure_filename(f.filename))
return 'file uploaded successfully'
if __name__ == "__main__":
app.run(host="0.0.0.0", debug="True", port="3800")

View File

@@ -1,49 +0,0 @@
body{
background-color: rgb(166, 253, 254);
}
h1{
text-align: center;
}
.tableH{
background-color: antiquewhite;
}
.tg {
border-collapse: collapse;
border-spacing: 0;
align-self: center;
width: 100%;
}
.tg td {
border-color: black;
border-style: solid;
border-width: 1px;
font-family: Arial, sans-serif;
font-size: 14px;
overflow: hidden;
padding: 10px 5px;
word-break: normal;
}
.tg th {
border-color: black;
border-style: solid;
border-width: 1px;
font-family: Arial, sans-serif;
font-size: 14px;
font-weight: normal;
overflow: hidden;
padding: 10px 5px;
word-break: normal;
}
.tg .tg-0lax {
text-align: center;
vertical-align: top;
border-radius: 100px;
border-radius: 100px;
}

View File

@@ -5,51 +5,54 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ url_for('static', filename='css/index.css')}}">
<title>3dprintered </title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css')}}">
<title>3d Detals</title>
</head>
<body>
<h1> Напечатанные детали </h1>
<div class="tableH">
<header>
<h1 class="h1header"> Каталог печатных 3д деталей </h1>
</header>
<div class="container">
<div class="row">
<table class="tg">
<thead>
<tr>
<th class="tg-0lax"></th>
<th class="tg-0lax">Изображения</th>
<th class="tg-0lax"> Напечатано ли</th>
<th class="tg-0lax">STL file</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
</tr>
<tr>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
</tr>
<tr>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
</tr>
<tr>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
<td class="tg-0lax"></td>
</tr>
</tbody>
</table>
{% for i in range(10) %}
<div class="col-md-4">
<div class="card">
<img class="card-img-top" src="{{ url_for('static', filename='img/{{i}}.jpg')}} " alt="1 image">
<div class="card-body">
<dv class="row">
<div class="col">
<button class="btn btn-block">Скачать исходник</button>
</div>
<div class="col">
<button class="btn btn-block">Скачать stl </button>
</div>
<div class="row">
<div class="col d-flex justify-content-center">
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
<label class="form-check-label" for="flexCheckDefault">
Напечатано
</label>
</div>
<div class="col d-flex justify-content-center">
<h5> {{ i }} </h5>
</div>
</div>
</div>
</div>
</div>
</body>
{%endfor%}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3"
crossorigin="anonymous"></script>
</body>
</html>