mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Started handling of session data
This commit is contained in:
2
config.json
vendored
2
config.json
vendored
@@ -1 +1 @@
|
||||
{"TITLE": "pyShelf E-Book Server", "VERSION": "0.5.0", "BOOKPATH": "/home/raelon/Books", "DB_HOST": "localhost", "DB_PORT": "5432", "DATABASE": "pyshelf", "USER": "pyshelf", "PASSWORD": "pyshelf", "BOOKSHELF": "data/shelf.json", "ALLOWED_HOSTS": "*", "hostname": "localhost", "webport": "8000", "wsgiport": "8001"}
|
||||
{"TITLE": "pyShelf E-Book Server", "VERSION": "0.5.0", "BOOKPATH": "/home/raelon/Books", "DB_HOST": "localhost", "DB_PORT": "5432", "DATABASE": "pyshelf", "USER": "pyshelf", "PASSWORD": "pyshelf", "BOOKSHELF": "data/shelf.json", "ALLOWED_HOSTS": "*", "hostname": "localhost", "webport": "8000", "wsgiport": "8001"}
|
||||
@@ -101,6 +101,10 @@ DATABASES = {
|
||||
"PASSWORD": CONFIG.password,
|
||||
}
|
||||
}
|
||||
# Session
|
||||
# Uncomment below to enable sessions management by a memcache server
|
||||
# https://docs.djangoproject.com/en/3.0/topics/http/sessions/
|
||||
# SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
"packageUri": "lib/"
|
||||
}
|
||||
],
|
||||
"generated": "2020-06-24T15:15:46.784320Z",
|
||||
"generated": "2020-06-28T03:58:01.082901Z",
|
||||
"generator": "pub",
|
||||
"generatorVersion": "2.8.4"
|
||||
}
|
||||
|
||||
2
src/interface/static/css/.packages
vendored
2
src/interface/static/css/.packages
vendored
@@ -1,4 +1,4 @@
|
||||
# Generated by pub on 2020-06-24 11:15:46.775314.
|
||||
# Generated by pub on 2020-06-27 23:58:01.069770.
|
||||
args:file:///home/raelon/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/
|
||||
async:file:///home/raelon/.pub-cache/hosted/pub.dartlang.org/async-2.4.1/lib/
|
||||
charcode:file:///home/raelon/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.3/lib/
|
||||
|
||||
180
src/interface/static/css/pubspec.lock
vendored
Normal file
180
src/interface/static/css/pubspec.lock
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.0"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
cli_repl:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_repl
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0+1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.14.13"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.1"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.4"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.2"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.8"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.8"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.3"
|
||||
package_resolver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_resolver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.10"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
pedantic:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
sass:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: sass
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.26.9"
|
||||
source_maps:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_maps
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.9"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.3"
|
||||
stream_transform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_transform
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
tuple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: tuple
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: watcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.7+15"
|
||||
sdks:
|
||||
dart: ">=2.7.0 <3.0.0"
|
||||
2
src/interface/templates/index.html
vendored
2
src/interface/templates/index.html
vendored
@@ -53,7 +53,7 @@
|
||||
<select id = "sortlist">
|
||||
<option value = "sort/title" id="title-sort">Title</option>
|
||||
<option value = "sort/author" id="author-sort">Author</option>
|
||||
<option value = "sort/collection" id="collection-sort">Collection</option>
|
||||
<option value = "sort/collections" id="collection-sort">Collection</option>
|
||||
<option value = "sort/tag" id="tag-sort">Tags</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@ def index(request, query=None, _set=1, _limit=None, _order='title'):
|
||||
"""
|
||||
Return template index
|
||||
"""
|
||||
_payload = payload(query, _set, _limit, _order)
|
||||
_payload = payload(request, query, _set, _limit, _order)
|
||||
return render(
|
||||
request,
|
||||
"index.html",
|
||||
@@ -304,7 +304,7 @@ def collections_list():
|
||||
collection_key.append(i.collection)
|
||||
return json.dumps(list(set(collection_key)))
|
||||
|
||||
def payload(query, _set, _limit, _order):
|
||||
def payload(request, query, _set, _limit, _order):
|
||||
"""
|
||||
Return formatted data to template
|
||||
# TODO hook into payload and provide handling of next,prev, & search combos
|
||||
@@ -315,11 +315,18 @@ def payload(query, _set, _limit, _order):
|
||||
_set_max = int(_set) * _limit
|
||||
_set_min = _set_max - _limit
|
||||
_now_showing = "%s of %s"%(_set_min, _set_max)
|
||||
|
||||
|
||||
if query:
|
||||
_results = Books().generic_search(query)
|
||||
_r_len = _results.count()
|
||||
_r, _search = _results[_set_min:_set_max], query
|
||||
if query != request.session.get('cached_query'):
|
||||
breakpoint()
|
||||
ses_query = request.session['cached_query'] = query
|
||||
ses_results = request.session['cached_results'] = Books().generic_search(query)
|
||||
_r_len = ses_results.count()
|
||||
_r, _search = ses_results[_set_min:_set_max], request.session.get('cached_query')
|
||||
elif query == request.session.get('cached_query'):
|
||||
_r, _search = request.session['cached_results'].order_by(_order)[_set_min:_set_max], request.session['cached_query']
|
||||
elif request.session['cached_query']:
|
||||
_r,_search = request.session['cached_results'].order_by(_order)[_set_min:_set_max], request.session['cached_query']
|
||||
else: _r, _r_len, _search = book_set(_order, _limit, _set), None, None
|
||||
|
||||
_bookstats, _collectionstats, _collectionobject = \
|
||||
|
||||
Reference in New Issue
Block a user