mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Django secret generated per install,
This commit is contained in:
@@ -22,7 +22,6 @@ class CustomUserAdmin(UserAdmin):
|
||||
)
|
||||
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Books)
|
||||
admin.site.register(Collections)
|
||||
admin.site.register(Favorites)
|
||||
|
||||
@@ -10754,4 +10754,8 @@ a.nav_link {
|
||||
.center {
|
||||
width: fit-content !important;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.collection {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -618,3 +618,6 @@ a.nav_link {
|
||||
width: fit-content !important;
|
||||
margin: auto;
|
||||
}
|
||||
.collection{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -185,20 +185,26 @@ $(document).ready(function(){
|
||||
success: function(response){
|
||||
// Set the dialog title
|
||||
$('#pop_over_0').dialog({
|
||||
title: "Collections",
|
||||
title: response.data['title'],
|
||||
maxHeight: (win_height-100),
|
||||
minWidth: $("#horiz_nav_main").width(),
|
||||
hide: { effect: "blind", duration: 1000 },
|
||||
show: { effect: "blind", duration: 1000 },
|
||||
position: { my: "top", at: "bottom", of: $("#horiz_nav_main")
|
||||
position: { my: "center center", at: "center center", of: window
|
||||
}
|
||||
});
|
||||
// clear and create a new container
|
||||
$('#pop_over_0').html('<div id=collections>');
|
||||
$('#pop_over_0').html('<div id=book_expanded>');
|
||||
// Populate the container from response.data
|
||||
$.each(response.data, function(index, value){
|
||||
$('#collections').append("<div class=collection data='"+value+"/"+$('#_set').val()+"'>"+value+"</div>");
|
||||
});
|
||||
$('#book_expanded').append('<div class=row><div class="col-auto">Title</div><div class="col-auto text-muted">'+response.data['title']+'</div></div>')
|
||||
$('#book_expanded').append('<div class=row><div class="col-auto">Author</div><div class="col-auto text-muted">'+response.data['author']+'</div></div>')
|
||||
if (response.data['description']!== null){
|
||||
$('#book_expanded').append('<div class=row><div class="col-auto">Expanded Description</div><div class="col-auto text-muted">'+response.data['description']+'</div></div>')
|
||||
|
||||
}
|
||||
if (response.data['tags'] !== null){
|
||||
$('#book_expanded').append('<div class=row><div class="col-auto">Tags</div><div class="col-auto text-muted">'+response.data['tags']+'</div></div>')
|
||||
}
|
||||
// Close the container
|
||||
$('#pop_over').append('</div>');
|
||||
// Now open this dialog
|
||||
|
||||
@@ -393,8 +393,11 @@ def live(request, **kwargs):
|
||||
if hook == "collection_listing":
|
||||
collections = collections_list()
|
||||
return JsonResponse({"data": collections}, status=200)
|
||||
elif hook == "book_details":
|
||||
return JsonResponse({"data": Books.objects.get(pk=kwargs['pk'])}, status=200)
|
||||
elif hook == "details":
|
||||
try: _pk = request.GET['pk']
|
||||
except KeyError as e: return False
|
||||
book = book_details(Books.objects.get(pk=_pk))
|
||||
return JsonResponse({"data": book}, status=200)
|
||||
elif hook == "register":
|
||||
html = render_to_string('signup.html', {'form': SignUpForm}, request)
|
||||
html += render_to_string('login.html', {'form': UserLoginForm}, request)
|
||||
@@ -403,7 +406,15 @@ def live(request, **kwargs):
|
||||
|
||||
return JsonResponse({"data": "Response sent"}, status=200)
|
||||
|
||||
|
||||
def book_details(book):
|
||||
return {
|
||||
'title': book.title,
|
||||
'author': book.author,
|
||||
'description': book.description,
|
||||
'tags': book.tags,
|
||||
'rights': book.rights,
|
||||
'pk': book.id
|
||||
}
|
||||
def payload(request, query, _set, _limit, _order, **kwargs):
|
||||
"""
|
||||
Return formatted data to template
|
||||
|
||||
Reference in New Issue
Block a user