mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Massive UI/UX Overhaul
This commit is contained in:
@@ -187,7 +187,29 @@ def download(request, pk):
|
||||
response["Content-Disposition"] = "attachment; filename=%s" % _fn
|
||||
return response
|
||||
|
||||
def favorite(request, pk):
|
||||
"""
|
||||
Favorite book by primary key
|
||||
"""
|
||||
_book = Books.objects.all().filter(pk=pk)[0]
|
||||
_fn = hr_name(_book)
|
||||
response = HttpResponse(
|
||||
open(os.path.abspath(_book.file_name), "rb"), content_type="application/zip"
|
||||
)
|
||||
response["Content-Disposition"] = "attachment; filename=%s" % _fn
|
||||
return response
|
||||
|
||||
def share(request, pk):
|
||||
"""
|
||||
Share book by primary key
|
||||
"""
|
||||
_book = Books.objects.all().filter(pk=pk)[0]
|
||||
_fn = hr_name(_book)
|
||||
response = HttpResponse(
|
||||
open(os.path.abspath(_book.file_name), "rb"), content_type="application/zip"
|
||||
)
|
||||
response["Content-Disposition"] = "attachment; filename=%s" % _fn
|
||||
return response
|
||||
def hr_name(book):
|
||||
"""
|
||||
Nicer file names
|
||||
|
||||
Reference in New Issue
Block a user