delete book button, some css, filepath
This commit is contained in:
parent
72004d6c51
commit
3aae397579
@ -93,7 +93,8 @@ background-color: #E8E8E8!important;
|
|||||||
|
|
||||||
.library_table .title_col{
|
.library_table .title_col{
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
padding-left: 10px;
|
padding-left: 90px;
|
||||||
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.library_table .author_col{
|
.library_table .author_col{
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<a href="{{ url_for('edit_book_by_id', id=book.id )}}">edit</a>
|
<a href="{{ url_for('edit_book_by_id', id=book.id )}}">edit</a>
|
||||||
|
<br>
|
||||||
|
<a href="{{ url_for('remove_book_by_id', id=book.id)}}">delete</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<th width="100px;">Filetype</th>
|
<th width="100px;">Filetype</th>
|
||||||
<th width="100px;">Category</th>
|
<th width="100px;">Category</th>
|
||||||
<th width="100px;">Stack</th>
|
<th width="100px;">Stack</th>
|
||||||
<th width="100px;">Add to stack</th>
|
<th width="100px;">Add to a stack</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<p>{{ stack.stack_description }} </p>
|
<p>{{ stack.stack_description }} </p>
|
||||||
|
|
||||||
<p>Books in this stack: {% for book in stack.books %}
|
<p style='font-weight:bold;'>Books in this stack: {% for book in stack.books %}
|
||||||
|
|
||||||
<li style="font-size: 18px;"> <a href="{{url_for('show_book_by_id', id=book.id)}}">{{book.title}}</a> </li>
|
<li style="font-size: 18px;"> <a href="{{url_for('show_book_by_id', id=book.id)}}">{{book.title}}</a> </li>
|
||||||
|
|
||||||
|
18
app/views.py
18
app/views.py
@ -165,15 +165,15 @@ def edit_book_by_id(id):
|
|||||||
flash('No selected file')
|
flash('No selected file')
|
||||||
return redirect(request.url)
|
return redirect(request.url)
|
||||||
if file and allowed_file(file.filename):
|
if file and allowed_file(file.filename):
|
||||||
filename = secure_filename(file.filename)
|
|
||||||
allbooks = db.session.query(Book).all()
|
allbooks = db.session.query(Book).all()
|
||||||
id = book.id
|
id = book.id
|
||||||
new_filename = str(id) +"_"+ filename
|
|
||||||
fullpath = os.path.join(app.config['UPLOAD_FOLDER'], new_filename)
|
filename = str(id) + "_" + secure_filename(file.filename)
|
||||||
name, file_extension = os.path.splitext(new_filename)
|
fullpath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
|
||||||
|
name, file_extension = os.path.splitext(filename)
|
||||||
file.save(fullpath)
|
file.save(fullpath)
|
||||||
book.cover = get_cover(fullpath, name)
|
book.cover = get_cover(fullpath, name)
|
||||||
book.file = new_filename
|
book.file = filename
|
||||||
else:
|
else:
|
||||||
flash('allowed file formats: %s' % ALLOWED_EXTENSIONS)
|
flash('allowed file formats: %s' % ALLOWED_EXTENSIONS)
|
||||||
|
|
||||||
@ -211,12 +211,12 @@ def add_book():
|
|||||||
flash('No selected file')
|
flash('No selected file')
|
||||||
return redirect(request.url)
|
return redirect(request.url)
|
||||||
if file and allowed_file(file.filename):
|
if file and allowed_file(file.filename):
|
||||||
filename = secure_filename(file.filename)
|
|
||||||
allbooks = db.session.query(Book).all()
|
allbooks = db.session.query(Book).all()
|
||||||
id = len(allbooks)+1
|
id = len(allbooks)+1
|
||||||
new_filename = str(id) +"_"+ filename
|
filename = str(id) + "_" + secure_filename(file.filename)
|
||||||
fullpath = os.path.join(app.config['UPLOAD_FOLDER'], new_filename)
|
|
||||||
name, file_extension = os.path.splitext(new_filename)
|
fullpath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
|
||||||
|
name, file_extension = os.path.splitext(filename)
|
||||||
file.save(fullpath)
|
file.save(fullpath)
|
||||||
cover = get_cover(fullpath, name)
|
cover = get_cover(fullpath, name)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user