mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-07 06:37:50 +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)
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
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,12 +8,14 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<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="author" content="{{ site_conf.site_author }}">
|
||||
<meta name="generator" content="Django Framework">
|
||||
<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="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
@@ -22,12 +24,15 @@
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
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>
|
||||
</head>
|
||||
<body>
|
||||
@@ -40,7 +45,10 @@
|
||||
</svg>
|
||||
<strong>{{ site_conf.site_name }}</strong>
|
||||
</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>
|
||||
</header>
|
||||
@@ -176,6 +184,12 @@
|
||||
</main>
|
||||
{% 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/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>
|
||||
</html>
|
||||
|
@@ -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.10"
|
||||
__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