mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
Add Catalogs views, but still need to fix templates (use books for now)
This commit is contained in:
@@ -139,4 +139,4 @@ class CatalogAdmin(SortableAdminBase, admin.ModelAdmin):
|
||||
|
||||
@admin.display(description="Scales")
|
||||
def get_scales(self, obj):
|
||||
return ", ".join(s.scale for s in obj.scales.all())
|
||||
return "/".join(s.scale for s in obj.scales.all())
|
||||
|
@@ -54,9 +54,6 @@ class BaseBook(BaseModel):
|
||||
Tag, related_name="bookshelf", blank=True
|
||||
)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("book", kwargs={"uuid": self.uuid})
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
shutil.rmtree(
|
||||
os.path.join(
|
||||
@@ -110,6 +107,9 @@ class Book(BaseBook):
|
||||
def publisher_name(self):
|
||||
return self.publisher.name
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("book", kwargs={"uuid": self.uuid})
|
||||
|
||||
|
||||
class Catalog(BaseBook):
|
||||
manufacturer = models.ForeignKey(
|
||||
@@ -127,3 +127,6 @@ class Catalog(BaseBook):
|
||||
def __str__(self):
|
||||
scales = "/".join([s.scale for s in self.scales.all()])
|
||||
return "%s %s %s" % (self.manufacturer.name, self.years, scales)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("catalog", kwargs={"uuid": self.uuid})
|
||||
|
Reference in New Issue
Block a user