mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 05:07:50 +02:00
Add a CSV export functionality in admin and add price fields (#41)
* Implement an action do download data in csv * Refactor CSV download * Move price to main models and add csv to bookshelf * Update template and API * Small refactoring
This commit is contained in:
@@ -17,6 +17,7 @@ class SiteConfigurationAdmin(SingletonModelAdmin):
|
||||
"about",
|
||||
"items_per_page",
|
||||
"items_ordering",
|
||||
"currency",
|
||||
"footer",
|
||||
"footer_extended",
|
||||
)
|
||||
|
21
ram/portal/migrations/0018_siteconfiguration_currency.py
Normal file
21
ram/portal/migrations/0018_siteconfiguration_currency.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.1.4 on 2024-12-29 15:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
(
|
||||
"portal",
|
||||
"0017_alter_flatpage_content_alter_siteconfiguration_about_and_more",
|
||||
),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="siteconfiguration",
|
||||
name="currency",
|
||||
field=models.CharField(default="EUR", max_length=3),
|
||||
),
|
||||
]
|
@@ -30,6 +30,7 @@ class SiteConfiguration(SingletonModel):
|
||||
],
|
||||
default="type",
|
||||
)
|
||||
currency = models.CharField(max_length=3, default="EUR")
|
||||
footer = tinymce.HTMLField(blank=True)
|
||||
footer_extended = tinymce.HTMLField(blank=True)
|
||||
show_version = models.BooleanField(default=True)
|
||||
|
@@ -113,6 +113,12 @@
|
||||
<th scope="row">Purchase date</th>
|
||||
<td>{{ book.purchase_date|default:"-" }}</td>
|
||||
</tr>
|
||||
{% if request.user.is_staff %}
|
||||
<tr>
|
||||
<th scope="row">Price ({{ site_conf.currency }})</th>
|
||||
<td>{{ book.price|default:"-" }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if properties %}
|
||||
|
@@ -187,6 +187,12 @@
|
||||
<th scope="row">Purchase date</th>
|
||||
<td>{{ rolling_stock.purchase_date|default:"-" }}</td>
|
||||
</tr>
|
||||
{% if request.user.is_staff %}
|
||||
<tr>
|
||||
<th scope="row">Price ({{ site_conf.currency }})</th>
|
||||
<td>{{ rolling_stock.price|default:"-" }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if properties %}
|
||||
|
Reference in New Issue
Block a user