mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Start on download system
This commit is contained in:
@@ -28,4 +28,4 @@ repos:
|
|||||||
rev: stable
|
rev: stable
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
language_version: python3.7
|
language_version: python3.8
|
||||||
|
|||||||
BIN
frontend/db.sqlite3
Executable file
BIN
frontend/db.sqlite3
Executable file
Binary file not shown.
@@ -14,10 +14,9 @@ Including another URLconf
|
|||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path
|
from django.urls import path, re_path
|
||||||
from interface import views
|
from interface import views
|
||||||
|
|
||||||
urlpatterns = [
|
path("admin/", admin.site.urls),
|
||||||
path("admin/", admin.site.urls),
|
path("", views.index, name="index"),
|
||||||
path("", views.index, name="index"),
|
re_path(r"^download/$/", views.download, name="download")
|
||||||
]
|
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ body{
|
|||||||
}
|
}
|
||||||
.app_footer{
|
.app_footer{
|
||||||
grid-area: app_footer;
|
grid-area: app_footer;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0px;
|
||||||
}
|
}
|
||||||
.left_col{
|
.left_col{
|
||||||
grid-area: left_col
|
grid-area: left_col
|
||||||
@@ -73,11 +75,20 @@ body{
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 25% 25% 25% 25%;
|
grid-template-columns: 25% 25% 25% 25%;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
font-family: 'Audiowide', cursive;
|
||||||
|
font-size: 25px;
|
||||||
}
|
}
|
||||||
.shelf_item{
|
.shelf_item{
|
||||||
|
background-color: burlywood;
|
||||||
|
margin: 10px 0px;
|
||||||
|
max-width: 300px;
|
||||||
|
max-height: 375px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
.book_thumb{
|
.book_thumb{
|
||||||
width: 300px;
|
width: 300px;
|
||||||
height: 375px;
|
height: 375px;
|
||||||
}
|
}
|
||||||
|
a.book_link{
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="app_body" >
|
<div class="app_body" >
|
||||||
<div class="left_col">
|
<div class="left_col">
|
||||||
left_col
|
Navigation and page controls will go here
|
||||||
</div>
|
</div>
|
||||||
<div class="shelf">
|
<div class="shelf">
|
||||||
<div class="shelf_contents" >
|
<div class="shelf_contents" >
|
||||||
<ul id="book_shelf">
|
<ul id="book_shelf">
|
||||||
{% for book in Books %}
|
{% for book in Books %}
|
||||||
<li class="shelf_item"><img alt="{{ book.title }}" src="data:image;base64,{{ book.cover | bin_2_img }}" class="book_thumb"/> </li>
|
<a href="{% url 'download' book.file_name %}" class="book_link"><li class="shelf_item"><img alt="{{ book.title }}" src="data:image;base64,{{ book.cover | bin_2_img }}" class="book_thumb"/> </li></a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from xsendfile import XSendfileApplication
|
||||||
|
|
||||||
from .models import Books
|
from .models import Books
|
||||||
|
|
||||||
@@ -7,6 +8,10 @@ def index(request):
|
|||||||
return render(request, "index.html", {"Books": Books.objects.all()})
|
return render(request, "index.html", {"Books": Books.objects.all()})
|
||||||
|
|
||||||
|
|
||||||
|
def download(request):
|
||||||
|
return XSendfileApplication(file_name)
|
||||||
|
|
||||||
|
|
||||||
def book_set(_set):
|
def book_set(_set):
|
||||||
r = 20
|
r = 20
|
||||||
x = _set * r
|
x = _set * r
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ use_parentheses = true
|
|||||||
# NOTE: the known_third_party setting is managed by
|
# NOTE: the known_third_party setting is managed by
|
||||||
# seed-isort-config and should not be modified directly.
|
# seed-isort-config and should not be modified directly.
|
||||||
# Any changes made to this setting will be overwritten.
|
# Any changes made to this setting will be overwritten.
|
||||||
known_third_party = ["PIL", "bs4", "django", "interface", "lib", "requests"]
|
known_third_party = ["PIL", "bs4", "django", "interface", "lib", "requests", "xsendfile"]
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ websockets
|
|||||||
pre-commit
|
pre-commit
|
||||||
isort
|
isort
|
||||||
django
|
django
|
||||||
|
xsendfile
|
||||||
|
|||||||
Reference in New Issue
Block a user