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

|

|
||||||
|
|
||||||
|
|
||||||
A `jff` (just for fun) project that aims to create a
|
A `jff` (just for fun) project that aims to create a
|
||||||
model railroad assets manager that allows to:
|
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.
|
Your model train may also catch fire while using this software.
|
||||||
|
|
||||||
|
Check out [my own instance](https://daniele.mynarrowgauge.org).
|
||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
Project is based on the following technologies and components:
|
Project is based on the following technologies and components:
|
||||||
@@ -138,14 +139,18 @@ To be continued ...
|
|||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
### Frontend
|
### Frontend
|
||||||
|

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

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

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

|
||||||
|
|
||||||

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

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

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

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

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,12 +8,14 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="color-scheme" content="light dark">
|
||||||
<meta name="description" content="{{ site_conf.about}}">
|
<meta name="description" content="{{ site_conf.about}}">
|
||||||
<meta name="author" content="{{ site_conf.site_author }}">
|
<meta name="author" content="{{ site_conf.site_author }}">
|
||||||
<meta name="generator" content="Django Framework">
|
<meta name="generator" content="Django Framework">
|
||||||
<title>{{ site_conf.site_name }}</title>
|
<title>{{ site_conf.site_name }}</title>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-nightshade.min.css" rel="stylesheet">
|
||||||
<link href="{% static "css/main.css" %}" rel="stylesheet">
|
<link href="{% static "css/main.css" %}" rel="stylesheet">
|
||||||
|
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
.bd-placeholder-img {
|
.bd-placeholder-img {
|
||||||
font-size: 1.125rem;
|
font-size: 1.125rem;
|
||||||
@@ -22,12 +24,15 @@
|
|||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
.bd-placeholder-img-lg {
|
.bd-placeholder-img-lg {
|
||||||
font-size: 3.5rem;
|
font-size: 3.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.d-light-inline { display: inline !important; }
|
||||||
|
.d-dark-inline { display: none !important; }
|
||||||
|
html.dark .d-light-inline { display: none !important; }
|
||||||
|
html.dark .d-dark-inline { display: inline !important; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -40,7 +45,10 @@
|
|||||||
</svg>
|
</svg>
|
||||||
<strong>{{ site_conf.site_name }}</strong>
|
<strong>{{ site_conf.site_name }}</strong>
|
||||||
</a>
|
</a>
|
||||||
{% include 'includes/login.html' %}
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
|
{% include 'includes/login.html' %}
|
||||||
|
<a id="darkmode-button" class="btn btn-sm btn-outline-dark"><i class="fa fa-moon-o fa-fw d-none d-light-inline" title="Switch to dark mode"></i><i class="fa fa-sun-o fa-fw d-none d-dark-inline" title="Switch to light mode"></i></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@@ -176,6 +184,12 @@
|
|||||||
</main>
|
</main>
|
||||||
{% include 'includes/footer.html' %}
|
{% include 'includes/footer.html' %}
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js" integrity="sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D" crossorigin="anonymous" async></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/js/darkmode.min.js"></script>
|
||||||
|
<!-- script src="https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js" integrity="sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D" crossorigin="anonymous" async></script -->
|
||||||
|
<script>
|
||||||
|
document.querySelector("#darkmode-button").onclick = function(e){
|
||||||
|
darkmode.toggleDarkMode();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -8,7 +8,17 @@
|
|||||||
{% for c in consist %}
|
{% for c in consist %}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="card shadow-sm">
|
<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">
|
<div class="card-body">
|
||||||
<p class="card-text" style="position: relative;">
|
<p class="card-text" style="position: relative;">
|
||||||
<strong>{{ c }}</strong>
|
<strong>{{ c }}</strong>
|
||||||
|
@@ -15,7 +15,24 @@
|
|||||||
{% block cards %}
|
{% block cards %}
|
||||||
{% for t in rolling_stock.image.all %}
|
{% for t in rolling_stock.image.all %}
|
||||||
<div class="col">
|
<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>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -61,6 +61,7 @@ class GetHomeFiltered(View):
|
|||||||
| Q(rolling_class__description__icontains=s)
|
| Q(rolling_class__description__icontains=s)
|
||||||
| Q(rolling_class__type__type__icontains=s)
|
| Q(rolling_class__type__type__icontains=s)
|
||||||
| Q(road_number__icontains=s)
|
| Q(road_number__icontains=s)
|
||||||
|
| Q(sku=s)
|
||||||
| Q(rolling_class__company__name__icontains=s)
|
| Q(rolling_class__company__name__icontains=s)
|
||||||
| Q(rolling_class__company__country__icontains=s)
|
| Q(rolling_class__company__country__icontains=s)
|
||||||
| Q(manufacturer__name__icontains=s)
|
| Q(manufacturer__name__icontains=s)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from ram.utils import git_suffix
|
from ram.utils import git_suffix
|
||||||
|
|
||||||
__version__ = "0.0.10"
|
__version__ = "0.0.14"
|
||||||
__version__ += git_suffix(__file__)
|
__version__ += git_suffix(__file__)
|
||||||
|
@@ -46,6 +46,22 @@ class RollingStockPropertyInline(admin.TabularInline):
|
|||||||
extra = 0
|
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)
|
@admin.register(RollingStock)
|
||||||
class RollingStockAdmin(admin.ModelAdmin):
|
class RollingStockAdmin(admin.ModelAdmin):
|
||||||
inlines = (
|
inlines = (
|
||||||
|
@@ -4,6 +4,7 @@ from uuid import uuid4
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
# from django.core.files.storage import FileSystemStorage
|
# from django.core.files.storage import FileSystemStorage
|
||||||
|
|
||||||
@@ -141,7 +142,12 @@ class RollingStockDocument(models.Model):
|
|||||||
return "{0}".format(os.path.basename(self.file.name))
|
return "{0}".format(os.path.basename(self.file.name))
|
||||||
|
|
||||||
def filename(self):
|
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):
|
class RollingStockImage(models.Model):
|
||||||
|
Reference in New Issue
Block a user