mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-07 14:47:49 +02:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
575c938205
|
|||
2af772a722
|
|||
f580bcffc5
|
|||
6accb66006
|
|||
f56accb4ff
|
|||
5a7b7fd79e | |||
dcdad71b1b | |||
321ae1065e | |||
e8efa5d87a | |||
97254b302c
|
|||
b8aa34ce1d
|
24
README.md
24
README.md
@@ -2,8 +2,7 @@
|
||||
|
||||
[](https://github.com/daniviga/django-rma/actions/workflows/django.yml)
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
A `jff` (just for fun) project that aims to create a
|
||||
model railroad assets manager that allows to:
|
||||
@@ -26,6 +25,8 @@ This project probably doesn't match you needs nor expectations. Be aware.
|
||||
|
||||
Your model train may also catch fire while using this software.
|
||||
|
||||
Check out [my own instance](https://daniele.mynarrowgauge.org).
|
||||
|
||||
## Components
|
||||
|
||||
Project is based on the following technologies and components:
|
||||
@@ -138,14 +139,18 @@ To be continued ...
|
||||
## Screenshots
|
||||
|
||||
### Frontend
|
||||

|
||||
---
|
||||

|
||||
---
|
||||

|
||||
|
||||
#### Dark mode
|
||||
|
||||

|
||||
|
||||

|
||||
---
|
||||

|
||||
---
|
||||

|
||||
---
|
||||

|
||||
|
||||
|
||||
|
||||
### Backoffice
|
||||
@@ -158,8 +163,7 @@ To be continued ...
|
||||
|
||||
### Rest API
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
@@ -8,7 +8,17 @@
|
||||
{% for c in consist %}
|
||||
<div class="col">
|
||||
<div class="card shadow-sm">
|
||||
{% if c.image %}<a href="{{ c.get_absolute_url }}"><img src="{{ c.image.url }}" alt="Card image cap"></a>{% endif %}
|
||||
<a href="{{ c.get_absolute_url }}">
|
||||
{% if c.image %}
|
||||
<img src="{{ c.image.url }}" alt="Card image cap">
|
||||
{% else %}
|
||||
{% with c.consist_item.first.rolling_stock as r %}
|
||||
{% for i in r.image.all %}
|
||||
{% if i.is_thumbnail %}<img src="{{ i.image.url }}" alt="Card image cap">{% endif %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</a>
|
||||
<div class="card-body">
|
||||
<p class="card-text" style="position: relative;">
|
||||
<strong>{{ c }}</strong>
|
||||
|
@@ -15,7 +15,24 @@
|
||||
{% block cards %}
|
||||
{% for t in rolling_stock.image.all %}
|
||||
<div class="col">
|
||||
<img class="img-thumbnail" src="{{ t.image.url }}" alt="Rolling stock image">
|
||||
<a href="" data-bs-toggle="modal" data-bs-target="#pictureModal{{ forloop.counter }}"><img class="img-thumbnail" src="{{ t.image.url }}" alt="Rolling stock image"></a>
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="pictureModal{{ forloop.counter }}" tabindex="-1" aria-labelledby="pictureModalLabel{{ forloop.counter }}" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="pictureModalLabel{{ forloop.counter }}">{{ rolling_stock }}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body text-center">
|
||||
<img class="rounded img-fluid" src="{{ t.image.url }}" alt="Rolling stock image">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
@@ -61,6 +61,7 @@ class GetHomeFiltered(View):
|
||||
| Q(rolling_class__description__icontains=s)
|
||||
| Q(rolling_class__type__type__icontains=s)
|
||||
| Q(road_number__icontains=s)
|
||||
| Q(sku=s)
|
||||
| Q(rolling_class__company__name__icontains=s)
|
||||
| Q(rolling_class__company__country__icontains=s)
|
||||
| Q(manufacturer__name__icontains=s)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
from ram.utils import git_suffix
|
||||
|
||||
__version__ = "0.0.11"
|
||||
__version__ = "0.0.14"
|
||||
__version__ += git_suffix(__file__)
|
||||
|
@@ -46,6 +46,22 @@ class RollingStockPropertyInline(admin.TabularInline):
|
||||
extra = 0
|
||||
|
||||
|
||||
@admin.register(RollingStockDocument)
|
||||
class RollingStockDocumentAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"__str__",
|
||||
"rolling_stock",
|
||||
"description",
|
||||
"download",
|
||||
)
|
||||
search_fields = (
|
||||
"rolling_stock__rolling_class__identifier",
|
||||
"rolling_stock__sku",
|
||||
"description",
|
||||
"file",
|
||||
)
|
||||
|
||||
|
||||
@admin.register(RollingStock)
|
||||
class RollingStockAdmin(admin.ModelAdmin):
|
||||
inlines = (
|
||||
|
@@ -4,6 +4,7 @@ from uuid import uuid4
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from django.dispatch import receiver
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
# from django.core.files.storage import FileSystemStorage
|
||||
|
||||
@@ -141,7 +142,12 @@ class RollingStockDocument(models.Model):
|
||||
return "{0}".format(os.path.basename(self.file.name))
|
||||
|
||||
def filename(self):
|
||||
return os.path.basename(self.file.name)
|
||||
return self.__str__()
|
||||
|
||||
def download(self):
|
||||
return mark_safe(
|
||||
'<a href="{0}" target="_blank">Link</a>'.format(self.file.url)
|
||||
)
|
||||
|
||||
|
||||
class RollingStockImage(models.Model):
|
||||
|
Reference in New Issue
Block a user