mirror of
https://github.com/daniviga/django-ram.git
synced 2026-02-05 10:30:38 +01:00
Compare commits
3 Commits
magazine
...
f45d754c91
| Author | SHA1 | Date | |
|---|---|---|---|
|
f45d754c91
|
|||
|
e9c9ede357
|
|||
| 39b0a9378b |
@@ -49,3 +49,5 @@ class CatalogSerializer(serializers.ModelSerializer):
|
|||||||
"price",
|
"price",
|
||||||
)
|
)
|
||||||
read_only_fields = ("creation_time", "updated_time")
|
read_only_fields = ("creation_time", "updated_time")
|
||||||
|
|
||||||
|
# FIXME: add Magazine and MagazineIssue serializers
|
||||||
|
|||||||
@@ -38,3 +38,5 @@ class CatalogGet(RetrieveAPIView):
|
|||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return Book.objects.get_published(self.request.user)
|
return Book.objects.get_published(self.request.user)
|
||||||
|
|
||||||
|
# FIXME: add Magazine and MagazineIssue views
|
||||||
|
|||||||
@@ -61,8 +61,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2" scope="row">
|
<th colspan="2" scope="row">
|
||||||
{% if type == "catalog" %}Catalog
|
{{ label|capfirst }}
|
||||||
{% elif type == "book" %}Book{% endif %}
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2" scope="row">
|
<th colspan="2" scope="row">
|
||||||
{{ d.type | capfirst }}
|
{{ d.label|capfirst }}
|
||||||
<div class="float-end">
|
<div class="float-end">
|
||||||
{% if not d.item.published %}
|
{% if not d.item.published %}
|
||||||
<span class="badge text-bg-warning">Unpublished</span>
|
<span class="badge text-bg-warning">Unpublished</span>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load dynamic_url %}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="card shadow-sm">
|
<div class="card shadow-sm">
|
||||||
{% if d.type == "magazine" %}
|
{% if d.type == "magazine" %}
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2" scope="row">
|
<th colspan="2" scope="row">
|
||||||
{{ d.type | capfirst }}
|
{{ d.label|capfirst }}
|
||||||
<div class="float-end">
|
<div class="float-end">
|
||||||
{% if not d.item.published %}
|
{% if not d.item.published %}
|
||||||
<span class="badge text-bg-warning">Unpublished</span>
|
<span class="badge text-bg-warning">Unpublished</span>
|
||||||
@@ -90,7 +91,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<a class="btn btn-sm btn-outline-primary" href="{{ d.item.get_absolute_url }}">Show all data</a>
|
<a class="btn btn-sm btn-outline-primary" href="{{ d.item.get_absolute_url }}">Show all data</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request.user.is_staff %}<a class="btn btn-sm btn-outline-danger" href="{% url 'admin:bookshelf_magazineissue_change' d.item.pk %}">Edit</a>{% endif %}
|
{% if request.user.is_staff %}<a class="btn btn-sm btn-outline-danger" href="{% dynamic_admin_url 'bookshelf' d.type d.item.pk %}">Edit</a>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ class GetData(View):
|
|||||||
self.filter = filter
|
self.filter = filter
|
||||||
data = []
|
data = []
|
||||||
for item in self.get_data(request):
|
for item in self.get_data(request):
|
||||||
data.append({"type": self.item_type, "item": item})
|
data.append({
|
||||||
|
"type": self.item_type,
|
||||||
|
"label": self.item_type.capitalize(),
|
||||||
|
"item": item
|
||||||
|
})
|
||||||
|
|
||||||
paginator = Paginator(data, get_items_per_page())
|
paginator = Paginator(data, get_items_per_page())
|
||||||
data = paginator.get_page(page)
|
data = paginator.get_page(page)
|
||||||
@@ -669,6 +673,7 @@ class GetMagazine(View):
|
|||||||
data = [
|
data = [
|
||||||
{
|
{
|
||||||
"type": "magazineissue",
|
"type": "magazineissue",
|
||||||
|
"label": "Magazine issue",
|
||||||
"item": i,
|
"item": i,
|
||||||
}
|
}
|
||||||
for i in magazine.issue.get_published(request.user).all()
|
for i in magazine.issue.get_published(request.user).all()
|
||||||
@@ -742,6 +747,7 @@ class GetBookCatalog(View):
|
|||||||
"documents": documents,
|
"documents": documents,
|
||||||
"properties": properties,
|
"properties": properties,
|
||||||
"type": selector,
|
"type": selector,
|
||||||
|
"label": selector.capitalize(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from ram.utils import git_suffix
|
from ram.utils import git_suffix
|
||||||
|
|
||||||
__version__ = "0.18.1"
|
__version__ = "0.18.3"
|
||||||
__version__ += git_suffix(__file__)
|
__version__ += git_suffix(__file__)
|
||||||
|
|||||||
Reference in New Issue
Block a user