Web bookshelf first draft

This commit is contained in:
2023-10-02 22:58:15 +02:00
parent 3f905877e7
commit 996ddd67ea
6 changed files with 137 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ class BookAdmin(SortableAdminBase, admin.ModelAdmin):
"get_authors",
"get_publisher",
"publication_year",
"numbers_of_pages"
"number_of_pages"
)
search_fields = ("title", "publisher__name", "authors__last_name")
list_filter = ("publisher__name", "authors")

View File

@@ -0,0 +1,18 @@
# Generated by Django 4.2.5 on 2023-10-02 20:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("bookshelf", "0003_bookimage"),
]
operations = [
migrations.RenameField(
model_name="book",
old_name="numbers_of_pages",
new_name="number_of_pages",
),
]

View File

@@ -1,6 +1,7 @@
from uuid import uuid4
from django.db import models
from django.conf import settings
from django.urls import reverse
from django_countries.fields import CountryField
from ckeditor_uploader.fields import RichTextUploadingField
@@ -41,7 +42,7 @@ class Book(models.Model):
choices=settings.LANGUAGES,
default='en'
)
numbers_of_pages = models.SmallIntegerField(null=True, blank=True)
number_of_pages = models.SmallIntegerField(null=True, blank=True)
publication_year = models.SmallIntegerField(null=True, blank=True)
purchase_date = models.DateField(null=True, blank=True)
tags = models.ManyToManyField(
@@ -58,7 +59,7 @@ class Book(models.Model):
return self.publisher.name
# def get_absolute_url(self):
# return reverse("rolling_stock", kwargs={"uuid": self.uuid})
# return reverse("books", kwargs={"uuid": self.uuid})
class BookImage(Image):