Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 47 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -9,7 +43,6 @@ __pycache__/
# Distribution / packaging
.Python
build/
build_data/
develop-eggs/
dist/
downloads/
Expand Down Expand Up @@ -83,7 +116,6 @@ target/
profile_default/
ipython_config.py


# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
Expand Down Expand Up @@ -117,7 +149,6 @@ __pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
client_data.json

# SageMath parsed files
*.sage.py
Expand All @@ -134,7 +165,6 @@ venv.bak/
# Spyder project settings
.spyderproject
.spyproject
client_data.json

# Rope project settings
.ropeproject
Expand All @@ -156,15 +186,22 @@ dmypy.json
# Cython debug symbols
cython_debug/

#my_folders
queries

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.ruff_cache
.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

pgdata/
# docker volumes
pgdata/
93 changes: 92 additions & 1 deletion apps/books/admin.py
Original file line number Diff line number Diff line change
@@ -1 +1,92 @@
# Register your models here.
from django.contrib import admin

from apps.books.models import Author, Book, Comment, Publisher, Tag


@admin.register(Author)
class AuthorAdmin(admin.ModelAdmin):
list_display = (
"first_name",
"last_name",
"bio",
)
search_fields = (
"first_name",
"last_name",
)
ordering = (
"first_name",
"last_name",
)


@admin.register(Book)
class BookAdmin(admin.ModelAdmin):
list_display = (
"title",
"authors_list",
"published_at",
"isbn_code",
"language",
)
list_filter = (
"language",
"publisher",
"tags",
)
search_fields = (
"title",
"isbn_code",
"description",
)

def authors_list(self, obj):
return ", ".join([str(a) for a in obj.author.all()])

authors_list.short_description = "Авторы"


@admin.register(Comment)
class CommentAdmin(admin.ModelAdmin):
list_display = (
"user",
"text",
"book",
"get_created",
)
list_filter = (
"user",
"book",
)

def get_created(self, obj):
return obj.created

get_created.short_description = "Дата создания"


@admin.register(Publisher)
class PublisherAdmin(admin.ModelAdmin):
list_display = (
"name",
"website",
)
search_fields = (
"name",
"website",
)
ordering = ("name",)


@admin.register(Tag)
class TagAdmin(admin.ModelAdmin):
list_display = (
"name",
"slug",
"color",
)
search_fields = (
"name",
"slug",
)
ordering = ("name",)
Loading