Première version affichage des vhcs
This commit is contained in:
@@ -19,6 +19,7 @@ from django.urls import path, include
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('collabs/', include('collabs.urls')),
|
path('collabs/', include('collabs.urls')),
|
||||||
|
path('vehicules/', include('vehicles.urls')),
|
||||||
path('caldav/', include('mycaldav.urls')),
|
path('caldav/', include('mycaldav.urls')),
|
||||||
#path('collabs_hour/', include('collabs.urls')),
|
#path('collabs_hour/', include('collabs.urls')),
|
||||||
]
|
]
|
||||||
|
@@ -37,5 +37,5 @@ class _vhc_infos_admin(admin.ModelAdmin):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(vehicles_infos, _vhc_infos_admin)
|
admin.site.register(Vehicles_infos, _vhc_infos_admin)
|
||||||
admin.site.register(vehicles, _vhc_admin)
|
admin.site.register(Vehicles, _vhc_admin)
|
||||||
|
@@ -21,7 +21,7 @@ TYPES_CHOICES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class vehicles(models.Model):
|
class Vehicles(models.Model):
|
||||||
sName = models.CharField("Indicatif", max_length=250)
|
sName = models.CharField("Indicatif", max_length=250)
|
||||||
nBases = models.CharField('Basé à ', max_length=1, choices=BASES_CHOICES, default=1)
|
nBases = models.CharField('Basé à ', max_length=1, choices=BASES_CHOICES, default=1)
|
||||||
nStatus = models.CharField('Statut', max_length=1, choices=STATUS_CHOICES, default=1)
|
nStatus = models.CharField('Statut', max_length=1, choices=STATUS_CHOICES, default=1)
|
||||||
@@ -34,8 +34,8 @@ class vehicles(models.Model):
|
|||||||
verbose_name_plural = "véhicules"
|
verbose_name_plural = "véhicules"
|
||||||
|
|
||||||
|
|
||||||
class vehicles_infos(models.Model):
|
class Vehicles_infos(models.Model):
|
||||||
Vehicle = models.ForeignKey(vehicles, on_delete=models.CASCADE, verbose_name="Véhicule")
|
Vehicle = models.ForeignKey(Vehicles, on_delete=models.CASCADE, verbose_name="Véhicule")
|
||||||
nType = models.CharField('Type', max_length=1, choices=TYPES_CHOICES, default=1)
|
nType = models.CharField('Type', max_length=1, choices=TYPES_CHOICES, default=1)
|
||||||
sTitle = models.CharField("Titre",max_length=250)
|
sTitle = models.CharField("Titre",max_length=250)
|
||||||
sDesc = models.TextField("Description")
|
sDesc = models.TextField("Description")
|
||||||
|
BIN
vehicles/static/vehicles/images/ocvs_rtw_1.png
Normal file
BIN
vehicles/static/vehicles/images/ocvs_rtw_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 505 KiB |
BIN
vehicles/static/vehicles/images/ocvs_rtw_2.png
Normal file
BIN
vehicles/static/vehicles/images/ocvs_rtw_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 452 KiB |
BIN
vehicles/static/vehicles/images/ocvs_rtw_3.png
Normal file
BIN
vehicles/static/vehicles/images/ocvs_rtw_3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 507 KiB |
BIN
vehicles/static/vehicles/images/ocvs_rtw_4.png
Normal file
BIN
vehicles/static/vehicles/images/ocvs_rtw_4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 478 KiB |
15
vehicles/static/vehicles/style.css
Normal file
15
vehicles/static/vehicles/style.css
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
.main_container{
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 350px;
|
||||||
|
}
|
||||||
|
.child{
|
||||||
|
width: 350px;
|
||||||
|
color: green;
|
||||||
|
border: solid 1px black;
|
||||||
|
background-repeat: no-repeat, repeat;
|
||||||
|
background-size: contain;
|
||||||
|
}
|
26
vehicles/templates/vhc/vhc.html
Normal file
26
vehicles/templates/vhc/vhc.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
{% load static %}
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
<link rel="stylesheet" href="{% static 'vehicles/style.css' %}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="main_container">
|
||||||
|
{% for vhc in list_vhc %}
|
||||||
|
{% with 'vehicles/images/ocvs_rtw_'|add:vhc.nStatus|add:'.png' as image_static %}
|
||||||
|
<div class="child">
|
||||||
|
<img width="350px" src="{% static image_static %}" >
|
||||||
|
{{vhc.sName}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endwith %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
15
vehicles/urls.py
Normal file
15
vehicles/urls.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
|
||||||
|
app_name = "vehicles"
|
||||||
|
urlpatterns = [
|
||||||
|
path('vhc', views.view_vhc, name='view_vhc'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
|
@@ -1,3 +1,17 @@
|
|||||||
|
from django.http import HttpResponse
|
||||||
|
from django.http import FileResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from django.views import generic
|
||||||
|
from django.template import loader
|
||||||
|
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||||
|
|
||||||
# Create your views here.
|
from vehicles.models import *
|
||||||
|
|
||||||
|
@xframe_options_exempt
|
||||||
|
def view_vhc(request):
|
||||||
|
template = loader.get_template("vhc/vhc.html")
|
||||||
|
context = {'list_vhc': Vehicles.objects.all()}
|
||||||
|
print("passs 1 ligne 12")
|
||||||
|
|
||||||
|
|
||||||
|
return HttpResponse(template.render(context,request))
|
||||||
|
Reference in New Issue
Block a user