setup skeleton page for bookshelf
parent
6add1abaed
commit
b3692810b6
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -4,4 +4,11 @@ from .models import Bookshelf, Book, BookshelfToBook
|
|||
|
||||
admin.site.register(Bookshelf)
|
||||
admin.site.register(Book)
|
||||
admin.site.register(BookshelfToBook)
|
||||
# admin.site.register(BookshelfToBook)
|
||||
|
||||
|
||||
class TemplateAdmin(admin.ModelAdmin):
|
||||
change_form_template = 'mgmt/templates/bookshelves.html'
|
||||
|
||||
|
||||
admin.site.register(BookshelfToBook, TemplateAdmin)
|
|
@ -0,0 +1,2 @@
|
|||
{% extends "mgmt/base_site.html" %}
|
||||
{% block title %}Test page{% endblock %}
|
|
@ -0,0 +1,8 @@
|
|||
from .models import Book, Bookshelf, BookshelfToBook
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
def booksInBookshelf(request, bookshelfId):
|
||||
idList = BookshelfToBook.objects.filter(fk_bookshelves=bookshelfId).values_list('fk_books', flat=True)
|
||||
books = Book.objects.filter(id__in=idList)
|
||||
return HttpResponse(books)
|
|
@ -15,7 +15,19 @@ Including another URLconf
|
|||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.conf.urls import url
|
||||
from bookshelf_management.apps.mgmt import views
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('bookshelves/<int:bookshelfId>', views.booksInBookshelf, name='detail')
|
||||
]
|
||||
|
||||
# class CustomAdminSite(admin.AdminSite):
|
||||
# def get_urls(self):
|
||||
# urls = super(CustomAdminSite, self).get_urls()
|
||||
# custom_urls = [
|
||||
# url('admin/bookshelves$',
|
||||
# self.admin_view(organization_admin.preview), name="preview"),
|
||||
# ]
|
||||
# return urls + custom_urls
|
Loading…
Reference in New Issue