Skip to content

Commit

Permalink
jrief#345 recreated in demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
micudaj committed Feb 9, 2023
1 parent 7bb2640 commit ad3bfc2
Show file tree
Hide file tree
Showing 143 changed files with 33,878 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ node_modules/
htmlcov
adminsortable2/static/adminsortable2/js/adminsortable2.*
adminsortable2/templates/adminsortable2/edit_inline
venv/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"nuxt.isNuxtApp": false
}
205 changes: 204 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions testapp/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from testapp.models import Author, Chapter, Chapter1, Chapter2, Book, Book1, Book2

from import_export import resources
from import_export.admin import ImportExportModelAdmin

class AuthorAdmin(admin.ModelAdmin):
list_display = ['name']
Expand Down Expand Up @@ -42,7 +44,6 @@ class SortableBookAdmin(SortableAdminMixin, admin.ModelAdmin):
list_per_page = 12
list_display = ['title', 'author', 'my_order']


class UpOrderedSortableBookAdmin(SortableBookAdmin):
inlines = [ChapterStackedInlineUpOrdered]
ordering = ['my_order']
Expand Down Expand Up @@ -130,9 +131,18 @@ def get_app_list(self, request, app_label=None):
return app_list


class BookResource(resources.ModelResource):

class Meta:
model = Book

class BookAdmin(SortableAdminMixin, ImportExportModelAdmin):
resource_classes = [BookResource]


admin.site = BookAdminSite()
admin.site.register(Author, AuthorAdmin)
admin.site.register(Book1, SortableBookAdmin, infix=0)
admin.site.register(Book1, BookAdmin, infix=0)
admin.site.register(Book1, SortableBookAdminStacked, name="Books (ordered by model, stacked inlines)", infix=1)
admin.site.register(Book2, SortableBookAdminStackedReversed, name="Books (reverse ordered by model, stacked inlines)", infix=2)
admin.site.register(Book, UpOrderedSortableBookAdmin, name="Books (ordered by admin, stacked inlines)", infix=3)
Expand Down
2 changes: 2 additions & 0 deletions testapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'django.contrib.messages',
'adminsortable2',
'testapp',
'import_export'
]

DATABASES = {
Expand Down Expand Up @@ -50,6 +51,7 @@

# URL that handles the static files served from STATIC_ROOT.
# Example: "http://media.lawrence.com/static/"
STATIC_ROOT = 'static/'
STATIC_URL = '/static/'

TEMPLATES = [{
Expand Down
Loading

0 comments on commit ad3bfc2

Please sign in to comment.