mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 21:27:49 +02:00
Move properties under model and class sections
This commit is contained in:
7
ram/portal/templates/includes/header.html
Normal file
7
ram/portal/templates/includes/header.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<section class="py-4 text-center container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="mx-auto">
|
||||||
|
{% block header_content %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
@@ -29,7 +29,6 @@
|
|||||||
<button class="nav-link" id="nav-class-tab" data-bs-toggle="tab" data-bs-target="#nav-class" type="button" role="tab" aria-controls="nav-class" aria-selected="false">Class data</button>
|
<button class="nav-link" id="nav-class-tab" data-bs-toggle="tab" data-bs-target="#nav-class" type="button" role="tab" aria-controls="nav-class" aria-selected="false">Class data</button>
|
||||||
{% if rolling_stock.decoder %}<button class="nav-link" id="nav-dcc-tab" data-bs-toggle="tab" data-bs-target="#nav-dcc" type="button" role="tab" aria-controls="nav-dcc" aria-selected="false">DCC</button>{% endif %}
|
{% if rolling_stock.decoder %}<button class="nav-link" id="nav-dcc-tab" data-bs-toggle="tab" data-bs-target="#nav-dcc" type="button" role="tab" aria-controls="nav-dcc" aria-selected="false">DCC</button>{% endif %}
|
||||||
{% if rolling_stock.notes %}<button class="nav-link" id="nav-notes-tab" data-bs-toggle="tab" data-bs-target="#nav-notes" type="button" role="tab" aria-controls="nav-notes" aria-selected="false">Notes</button>{% endif %}
|
{% if rolling_stock.notes %}<button class="nav-link" id="nav-notes-tab" data-bs-toggle="tab" data-bs-target="#nav-notes" type="button" role="tab" aria-controls="nav-notes" aria-selected="false">Notes</button>{% endif %}
|
||||||
{% if properties.count > 0 %}<button class="nav-link" id="nav-properties-tab" data-bs-toggle="tab" data-bs-target="#nav-properties" type="button" role="tab" aria-controls="nav-properties" aria-selected="false">Properties</button>{% endif %}
|
|
||||||
{% if rolling_stock.document.count > 0 %}<button class="nav-link" id="nav-documents-tab" data-bs-toggle="tab" data-bs-target="#nav-documents" type="button" role="tab" aria-controls="nav-documents" aria-selected="false">Documents</button>{% endif %}
|
{% if rolling_stock.document.count > 0 %}<button class="nav-link" id="nav-documents-tab" data-bs-toggle="tab" data-bs-target="#nav-documents" type="button" role="tab" aria-controls="nav-documents" aria-selected="false">Documents</button>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -139,6 +138,23 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{% if rolling_stock_properties %}
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2" scope="row">Properties</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for p in rolling_stock_properties %}
|
||||||
|
<tr>
|
||||||
|
<th width="35%" scope="row">{{ p.property }}</th>
|
||||||
|
<td>{{ p.value }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="nav-class" role="tabpanel" aria-labelledby="nav-class-tab">
|
<div class="tab-pane fade" id="nav-class" role="tabpanel" aria-labelledby="nav-class-tab">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
@@ -170,6 +186,23 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{% if class_properties %}
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2" scope="row">Properties</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for p in class_properties %}
|
||||||
|
<tr>
|
||||||
|
<th width="35%" scope="row">{{ p.property }}</th>
|
||||||
|
<td>{{ p.value }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="nav-dcc" role="tabpanel" aria-labelledby="nav-dcc-tab">
|
<div class="tab-pane fade" id="nav-dcc" role="tabpanel" aria-labelledby="nav-dcc-tab">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
@@ -209,23 +242,6 @@
|
|||||||
<div class="tab-pane fade" id="nav-notes" role="tabpanel" aria-labelledby="nav-notes-tab">
|
<div class="tab-pane fade" id="nav-notes" role="tabpanel" aria-labelledby="nav-notes-tab">
|
||||||
{{ rolling_stock.notes | markdown | safe }}
|
{{ rolling_stock.notes | markdown | safe }}
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="nav-properties" role="tabpanel" aria-labelledby="nav-properties-tab">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2" scope="row">Properties</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for p in properties %}
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{{ p.property }}</th>
|
|
||||||
<td>{{ p.value }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane fade" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
<div class="tab-pane fade" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
|
@@ -113,7 +113,14 @@ class GetRollingStock(View):
|
|||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
properties = (
|
import pdb; pdb.set_trace()
|
||||||
|
class_properties = (
|
||||||
|
rolling_stock.rolling_class.property.all() if
|
||||||
|
request.user.is_authenticated else
|
||||||
|
rolling_stock.rolling_class.property.filter(
|
||||||
|
property__private=False)
|
||||||
|
)
|
||||||
|
rolling_stock_properties = (
|
||||||
rolling_stock.property.all() if
|
rolling_stock.property.all() if
|
||||||
request.user.is_authenticated else
|
request.user.is_authenticated else
|
||||||
rolling_stock.property.filter(property__private=False)
|
rolling_stock.property.filter(property__private=False)
|
||||||
@@ -124,7 +131,8 @@ class GetRollingStock(View):
|
|||||||
"page.html",
|
"page.html",
|
||||||
{
|
{
|
||||||
"rolling_stock": rolling_stock,
|
"rolling_stock": rolling_stock,
|
||||||
"properties": properties,
|
"class_properties": class_properties,
|
||||||
|
"rolling_stock_properties": rolling_stock_properties,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from ram.utils import git_suffix
|
from ram.utils import git_suffix
|
||||||
|
|
||||||
__version__ = "0.0.4"
|
__version__ = "0.0.5"
|
||||||
__version__ += git_suffix(__file__)
|
__version__ += git_suffix(__file__)
|
||||||
|
@@ -0,0 +1,24 @@
|
|||||||
|
# Generated by Django 4.0.6 on 2022-07-13 17:58
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('roster', '0005_alter_rollingstockproperty_rolling_stock'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='rollingclassproperty',
|
||||||
|
name='rolling_class',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='property', to='roster.rollingclass', verbose_name='Class'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='rollingstock',
|
||||||
|
name='rolling_class',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rolling_class', to='roster.rollingclass', verbose_name='Class'),
|
||||||
|
),
|
||||||
|
]
|
@@ -55,6 +55,7 @@ class RollingClassProperty(models.Model):
|
|||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
null=False,
|
null=False,
|
||||||
blank=False,
|
blank=False,
|
||||||
|
related_name="property",
|
||||||
verbose_name="Class",
|
verbose_name="Class",
|
||||||
)
|
)
|
||||||
property = models.ForeignKey(Property, on_delete=models.CASCADE)
|
property = models.ForeignKey(Property, on_delete=models.CASCADE)
|
||||||
@@ -74,6 +75,7 @@ class RollingStock(models.Model):
|
|||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
null=False,
|
null=False,
|
||||||
blank=False,
|
blank=False,
|
||||||
|
related_name="rolling_class",
|
||||||
verbose_name="Class",
|
verbose_name="Class",
|
||||||
)
|
)
|
||||||
road_number = models.CharField(max_length=128, unique=False)
|
road_number = models.CharField(max_length=128, unique=False)
|
||||||
|
Reference in New Issue
Block a user