-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
now it works the list view and the form view
- Loading branch information
Showing
6 changed files
with
103 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from django.contrib import admin | ||
|
||
def register(model, model_admin): | ||
admin.site.register([model], model_admin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ | |
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.sites', | ||
'django.contrib.staticfiles', | ||
|
||
# Third party | ||
'django_neomodel', | ||
|
@@ -69,6 +70,9 @@ | |
"django.contrib.messages.middleware.MessageMiddleware", | ||
] | ||
|
||
STATIC_ROOT = "./static/" | ||
STATIC_URL = '/static/' | ||
|
||
DJANGO_SUPERUSER_PASSWORD = "1234" | ||
DJANGO_SUPERUSER_EMAIL = "[email protected]" | ||
DJANGO_SUPERUSER_USERNAME = "admin" | ||
DJANGO_SUPERUSER_USERNAME = "admin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
from django.contrib import admin | ||
from django.contrib import admin as dj_admin | ||
from django_neomodel import admin as neo_admin | ||
from .models import Library, Book, Shelf | ||
|
||
from .models import Library | ||
|
||
|
||
@admin.register(Library) | ||
class LibraryAdmin(admin.ModelAdmin): | ||
class LibraryAdmin(dj_admin.ModelAdmin): | ||
list_display = ( | ||
"id", | ||
"name", | ||
) | ||
dj_admin.site.register(Library, LibraryAdmin) | ||
|
||
|
||
class BookAdmin(dj_admin.ModelAdmin): | ||
list_display = ("title", "created") | ||
neo_admin.register(Book, BookAdmin) | ||
|
||
|
||
class ShelfAdmin(dj_admin.ModelAdmin): | ||
list_display = ("name",) | ||
neo_admin.register(Shelf, ShelfAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
from django.conf.urls import url | ||
from django.contrib import admin | ||
from django.conf import settings | ||
from django.conf.urls.static import static | ||
|
||
|
||
urlpatterns = [url(r"^admin/", admin.site.urls)] | ||
urlpatterns = [url(r"^admin/", admin.site.urls)] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) |