Drop Django templates

This commit is contained in:
Emmy D'Anello 2024-02-02 00:59:25 +01:00
parent 311a29cf4b
commit 10dac73146
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
42 changed files with 1 additions and 110021 deletions

1
.gitignore vendored
View File

@ -37,6 +37,7 @@ secrets.py
media/
output/
/static/
/static_files/
# Virtualenv
.env/

View File

@ -38,5 +38,4 @@ urlpatterns = [
path("admin/", admin.site.urls, name="admin"),
path("api/", include(router.urls)),
path("api-auth/", include('rest_framework.urls', namespace='rest_framework')),
path("gtfs/", include("sncfgtfs.urls"), name="gtfs"),
]

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/assets/img/docs/favicons/mstile-150x150.png"/>
<TileColor>#00aba9</TileColor>
</tile>
</msapplication>
</browserconfig>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,19 +0,0 @@
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/assets/img/docs/favicons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/assets/img/docs/favicons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -1,90 +0,0 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="1596.000000pt" height="1596.000000pt" viewBox="0 0 1596.000000 1596.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.11, written by Peter Selinger 2001-2013
</metadata>
<g transform="translate(0.000000,1596.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M688 12165 c-2 -2 -93 -6 -203 -9 -280 -9 -317 -16 -393 -73 -27 -20
-67 -77 -61 -85 2 -2 -3 -14 -11 -27 -10 -20 -12 -765 -12 -3990 l0 -3967 22
-52 c28 -64 96 -127 154 -143 44 -12 14060 -17 14124 -5 111 21 153 73 216
272 27 82 70 217 96 299 27 83 76 236 110 340 34 105 63 197 65 205 2 8 26 85
53 170 28 85 83 256 122 380 103 325 121 379 141 440 10 30 55 170 99 310 45
140 104 325 132 410 27 85 51 160 52 165 3 13 108 342 146 455 24 74 78 246
86 275 2 6 53 165 114 355 61 190 113 352 115 360 2 8 14 44 25 80 79 243 86
286 62 359 -8 24 -33 61 -55 82 -83 81 -646 418 -1102 659 -478 253 -1069 527
-1580 732 -82 33 -163 66 -180 73 -16 8 -96 38 -176 69 -579 220 -1264 448
-1854 615 -99 28 -202 58 -230 66 -27 8 -120 33 -205 55 -85 23 -177 48 -205
55 -50 14 -598 149 -645 159 -14 3 -115 26 -225 51 -110 25 -209 47 -220 50
-11 2 -96 20 -190 40 -191 40 -298 62 -336 69 -14 2 -73 13 -130 25 -57 11
-115 23 -129 25 -14 3 -50 9 -80 15 -30 6 -71 13 -90 16 -19 3 -42 8 -50 10
-8 2 -31 7 -50 10 -19 3 -57 10 -85 15 -27 5 -63 12 -80 15 -60 10 -621 104
-660 110 -22 3 -53 8 -70 11 -16 2 -43 6 -60 9 -41 6 -443 64 -480 70 -16 2
-84 11 -150 20 -66 8 -136 18 -155 21 -19 3 -54 7 -78 9 -23 3 -55 7 -70 9
-15 3 -52 8 -82 11 -30 3 -66 8 -80 10 -14 2 -50 7 -80 10 -30 3 -89 10 -130
15 -101 12 -156 19 -215 25 -99 11 -141 15 -230 25 -49 5 -117 12 -150 15 -33
3 -103 10 -155 15 -52 5 -122 12 -155 15 -57 5 -97 8 -217 20 -29 3 -84 8
-123 10 -38 3 -90 8 -115 10 -25 3 -83 7 -130 10 -47 3 -101 7 -120 10 -19 2
-82 7 -140 10 -58 3 -125 8 -150 10 -79 7 -233 17 -300 20 -36 2 -112 6 -170
9 -186 12 -262 16 -395 21 -71 3 -168 7 -215 10 -124 6 -382 16 -560 21 -176
6 -1717 13 -1722 9z m2979 -3469 c89 -4 170 -8 180 -10 10 -2 49 -7 86 -11 37
-3 76 -8 85 -10 9 -1 42 -6 72 -11 30 -4 57 -8 60 -9 3 -1 26 -5 53 -9 26 -5
47 -11 47 -15 0 -3 -16 -56 -35 -116 -19 -61 -56 -176 -82 -258 l-47 -147 -40
6 c-22 3 -43 7 -46 9 -3 2 -21 6 -40 9 -19 3 -46 8 -60 10 -149 28 -289 40
-470 40 -125 0 -283 -9 -330 -19 -13 -2 -42 -7 -65 -10 -204 -28 -404 -110
-533 -220 -35 -30 -84 -112 -98 -165 -43 -168 91 -283 616 -529 226 -106 587
-286 690 -345 368 -209 568 -396 651 -610 73 -187 36 -407 -106 -631 -21 -33
-41 -62 -45 -65 -3 -3 -14 -16 -23 -30 -60 -88 -237 -238 -372 -316 -63 -36
-100 -55 -200 -99 -90 -40 -332 -109 -455 -130 -19 -3 -60 -10 -90 -15 -30 -5
-80 -12 -110 -16 -30 -3 -66 -7 -80 -10 -106 -17 -603 -25 -760 -11 -78 7
-317 39 -385 52 -72 14 -303 66 -331 76 -17 5 -42 12 -55 14 -112 22 -619 201
-619 219 0 2 17 42 39 88 21 45 49 106 61 133 13 28 42 91 65 140 23 50 52
114 65 143 17 38 29 52 40 48 8 -2 73 -30 143 -60 185 -81 509 -185 659 -211
15 -3 59 -12 96 -20 38 -7 90 -17 118 -20 27 -3 61 -8 76 -11 160 -31 578 -36
743 -9 116 19 124 21 212 45 329 90 481 327 347 541 -51 81 -201 204 -364 298
-30 17 -156 81 -280 142 -541 265 -689 347 -864 478 -346 261 -458 537 -345
851 108 298 398 527 849 670 36 11 74 22 85 25 11 2 38 9 60 15 120 30 300 63
425 76 25 2 63 6 85 8 22 3 101 8 175 11 74 4 136 8 137 9 3 2 153 -1 310 -8z
m7368 0 c109 -9 276 -26 304 -31 9 -2 24 -4 34 -4 13 -1 16 -7 13 -23 -6 -28
-183 -545 -191 -558 -4 -6 -18 -8 -33 -5 -212 36 -760 41 -977 10 -22 -3 -56
-8 -75 -11 -270 -36 -614 -165 -835 -313 -212 -142 -374 -320 -479 -529 -58
-114 -107 -267 -120 -372 -3 -25 -8 -56 -11 -70 -8 -37 -8 -218 0 -275 55
-418 326 -723 767 -863 143 -46 258 -70 433 -89 144 -16 666 -8 785 12 14 2
41 6 60 9 19 3 60 10 90 16 30 6 66 14 80 16 14 3 28 8 31 12 3 4 26 72 52
152 25 80 82 260 127 400 45 140 111 347 147 460 36 113 78 243 93 290 15 47
37 117 49 155 37 116 162 507 176 550 8 22 48 148 90 280 64 200 216 679 230
723 3 6 10 12 17 13 61 2 2830 0 2833 -2 3 -4 -159 -532 -169 -548 -4 -5 -421
-9 -983 -9 -538 -1 -995 -1 -1015 -1 -36 -1 -38 -3 -52 -48 -8 -27 -35 -113
-61 -193 -96 -298 -215 -671 -215 -674 0 -2 381 -4 846 -4 465 0 848 -2 850
-4 2 -3 -7 -38 -20 -79 -13 -41 -51 -160 -85 -265 l-61 -191 -833 -1 c-457 -1
-842 -1 -853 -2 -20 0 -24 -6 -40 -65 -1 -5 -41 -131 -89 -280 -48 -148 -95
-297 -105 -330 -10 -33 -39 -125 -65 -205 -26 -80 -73 -228 -104 -329 -58
-183 -58 -184 -96 -202 -124 -61 -537 -170 -770 -204 -22 -4 -47 -8 -55 -10
-8 -2 -44 -7 -80 -11 -36 -3 -68 -8 -71 -10 -3 -2 -41 -6 -84 -10 -44 -3 -87
-7 -96 -9 -112 -22 -659 -22 -775 -1 -11 2 -50 7 -89 12 -38 4 -72 8 -75 9 -3
0 -27 5 -55 10 -243 42 -470 116 -690 227 -55 27 -107 56 -116 64 -8 8 -19 14
-23 14 -15 0 -163 109 -247 183 -214 187 -385 464 -444 717 -36 156 -34 152
-58 148 -23 -3 -37 -39 -135 -348 -17 -52 -53 -165 -80 -250 -28 -85 -78 -243
-112 -350 -34 -107 -69 -215 -77 -240 -8 -25 -16 -49 -17 -55 -2 -5 -9 -29
-16 -52 l-13 -43 -428 0 -428 0 -11 43 c-57 219 -251 780 -329 949 -11 26 -21
49 -21 52 0 3 -11 29 -24 58 -13 29 -40 91 -61 138 -126 280 -299 613 -475
915 -77 133 -181 298 -283 452 l-121 182 -17 -47 c-14 -38 -159 -483 -164
-502 -3 -11 -38 -120 -135 -420 -56 -173 -126 -391 -156 -485 -30 -93 -60
-172 -66 -176 -21 -13 -37 3 -54 54 -23 70 -78 179 -127 252 -48 70 -175 200
-264 269 -35 27 -63 52 -63 56 0 3 30 98 66 211 73 228 225 700 304 944 29 88
53 165 54 170 1 6 7 24 13 40 6 17 41 125 78 240 36 116 69 219 73 229 8 18
25 19 400 19 290 -1 396 -4 406 -13 8 -6 57 -66 108 -133 515 -672 973 -1477
1261 -2217 24 -63 50 -133 57 -155 l13 -40 28 85 c32 97 163 510 186 585 9 28
29 88 44 135 15 47 55 171 88 275 32 105 98 312 146 460 124 388 216 678 271
850 26 83 50 154 54 158 7 8 740 16 740 8 0 -2 -25 -80 -56 -175 -30 -94 -57
-175 -58 -181 -2 -5 -6 -17 -9 -25 -6 -15 -58 -185 -63 -205 -1 -5 -16 -51
-33 -102 -37 -111 -38 -123 -8 -123 14 0 58 35 127 101 86 83 268 229 356 287
153 99 365 206 549 275 104 39 331 107 405 122 14 3 63 12 110 21 47 9 92 18
101 19 9 2 40 6 69 10 29 4 62 8 72 10 11 2 63 7 116 11 53 3 99 8 101 10 6 6
612 -3 696 -10z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="26px" height="26px" viewBox="0 0 26 26" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49.3 (51167) - http://www.bohemiancoding.com/sketch -->
<title>Icons/Langages/english</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icons/Langages/english" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M7.9224,24.9701 L7.9224,18.9461 L3.0644,21.3741 C4.3714,22.9231 6.0294,24.1661 7.9224,24.9701" id="Fill-1" fill="#00247D"></path>
<path d="M18.0781,24.9701 C19.9701,24.1661 21.6291,22.9231 22.9351,21.3741 L18.0781,18.9461 L18.0781,24.9701 Z" id="Fill-3" fill="#00247D"></path>
<path d="M3.064,4.6258 L7.922,7.0548 L7.922,1.0298 C6.03,1.8338 4.371,3.0768 3.064,4.6258" id="Fill-5" fill="#00247D"></path>
<path d="M18.0781,1.0301 L18.0781,7.0541 L22.9351,4.6261 C21.6291,3.0761 19.9701,1.8341 18.0781,1.0301" id="Fill-7" fill="#00247D"></path>
<path d="M7.9224,7.0545 L3.0644,4.6255 C2.8414,4.8885 2.6344,5.1645 2.4344,5.4455 L7.3864,7.9225 L1.0304,7.9225 C0.8704,8.2975 0.7304,8.6815 0.6064,9.0745 C0.5154,9.3615 0.4444,9.6575 0.3744,9.9535 L2.3644,9.9535 L9.9534,9.9535 L9.9534,9.2055 L9.9534,8.0705 L9.9534,0.3735 C9.2544,0.5415 8.5724,0.7535 7.9224,1.0305 L7.9224,7.0545 Z" id="Fill-9" fill="#FFFFFF"></path>
<path d="M25.626,9.9535 C25.555,9.6575 25.484,9.3615 25.394,9.0745 C25.27,8.6825 25.129,8.2975 24.97,7.9225 L18.613,7.9225 L23.566,5.4455 C23.365,5.1645 23.158,4.8895 22.936,4.6255 L18.078,7.0545 L18.078,1.0305 C17.428,0.7535 16.746,0.5415 16.047,0.3735 L16.047,8.0705 L16.047,9.2055 L16.047,9.9535 L23.636,9.9535 L25.626,9.9535 Z" id="Fill-11" fill="#FFFFFF"></path>
<path d="M0.374,16.0462 C0.445,16.3422 0.516,16.6382 0.606,16.9262 C0.73,17.3172 0.871,17.7022 1.03,18.0772 L7.387,18.0772 L2.434,20.5542 C2.635,20.8352 2.842,21.1102 3.064,21.3742 L7.922,18.9452 L7.922,24.9702 C8.572,25.2452 9.254,25.4572 9.953,25.6262 L9.953,17.9302 L9.953,16.7942 L9.953,16.0462 L2.365,16.0462 L0.374,16.0462 Z" id="Fill-13" fill="#FFFFFF"></path>
<path d="M16.0469,16.0462 L16.0469,16.7942 L16.0469,17.9302 L16.0469,25.6262 C16.7459,25.4572 17.4279,25.2452 18.0779,24.9702 L18.0779,18.9452 L22.9359,21.3742 C23.1579,21.1102 23.3649,20.8352 23.5669,20.5542 L18.6129,18.0772 L24.9699,18.0772 C25.1289,17.7022 25.2699,17.3172 25.3939,16.9252 C25.4849,16.6382 25.5549,16.3422 25.6259,16.0462 L23.6359,16.0462 L16.0469,16.0462 Z" id="Fill-15" fill="#FFFFFF"></path>
<path d="M23.5664,5.4456 L18.6134,7.9226 L24.9694,7.9226 C24.5954,7.0406 24.1174,6.2156 23.5664,5.4456" id="Fill-17" fill="#CF142B"></path>
<path d="M23.5664,20.554 C24.1174,19.784 24.5954,18.959 24.9694,18.077 L18.6134,18.077 L23.5664,20.554 Z" id="Fill-19" fill="#CF142B"></path>
<path d="M2.4341,20.554 L7.3871,18.077 L1.0301,18.077 C1.4051,18.959 1.8831,19.784 2.4341,20.554" id="Fill-21" fill="#CF142B"></path>
<path d="M2.4341,5.4456 C1.8831,6.2156 1.4051,7.0406 1.0301,7.9226 L7.3871,7.9226 L2.4341,5.4456 Z" id="Fill-23" fill="#CF142B"></path>
<path d="M25.6582,10.077 C25.6482,10.035 25.6362,9.995 25.6262,9.953 L23.6362,9.953 L16.0472,9.953 L16.0472,9.205 L16.0472,8.07 L16.0472,0.374 C15.0672,0.139 14.0512,0 13.0002,0 C11.9492,0 10.9322,0.139 9.9532,0.374 L9.9532,8.07 L9.9532,9.205 L9.9532,9.953 L2.3652,9.953 L0.3742,9.953 C0.3642,9.995 0.3512,10.035 0.3422,10.077 C0.1252,11.018 0.0002,11.994 0.0002,13 C0.0002,14.006 0.1252,14.982 0.3422,15.923 C0.3512,15.964 0.3642,16.005 0.3742,16.046 L2.3652,16.046 L9.9532,16.046 L9.9532,16.794 L9.9532,17.93 L9.9532,25.626 C10.9322,25.862 11.9492,26 13.0002,26 C14.0512,26 15.0672,25.862 16.0472,25.626 L16.0472,17.93 L16.0472,16.794 L16.0472,16.046 L23.6362,16.046 L25.6262,16.046 C25.6362,16.005 25.6482,15.964 25.6582,15.923 C25.8752,14.982 26.0002,14.006 26.0002,13 C26.0002,11.994 25.8752,11.018 25.6582,10.077" id="Fill-25" fill="#CF142B"></path>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="26px" height="26px" viewBox="0 0 26 26" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49.3 (51167) - http://www.bohemiancoding.com/sketch -->
<title>Icons/Langages/french</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icons/Langages/french" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M13,26 C14.637,26 16.195,25.688 17.636,25.14 L17.636,0.861 C16.195,0.313 14.637,0 13,0 C11.363,0 9.805,0.313 8.364,0.861 L8.364,25.14 C9.805,25.688 11.363,26 13,26" id="Fill-1" fill="#FFFFFF"></path>
<path d="M26,13 C26,7.437 22.531,2.723 17.636,0.861 L17.636,25.14 C22.531,23.277 26,18.562 26,13" id="Fill-3" fill="#FF0000"></path>
<path d="M0,13 C0,18.562 3.469,23.277 8.364,25.14 L8.364,0.861 C3.469,2.723 0,7.437 0,13" id="Fill-5" fill="#0088CE"></path>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 968 B

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="26px" height="26px" viewBox="0 0 26 26" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49.3 (51167) - http://www.bohemiancoding.com/sketch -->
<title>Icons/Langages/deutsch</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icons/Langages/deutsch" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M0,13 C0,14.637 0.313,16.195 0.861,17.636 L25.14,17.636 C25.687,16.195 26,14.637 26,13 C26,11.363 25.687,9.805 25.14,8.364 L0.861,8.364 C0.313,9.805 0,11.363 0,13" id="Fill-1" fill="#FF0000"></path>
<path d="M13,26 C18.562,26 23.277,22.531 25.14,17.636 L0.861,17.636 C2.723,22.531 7.437,26 13,26" id="Fill-3" fill="#FECE00"></path>
<path d="M13,0 C7.437,0 2.723,3.469 0.861,8.364 L25.14,8.364 C23.277,3.469 18.562,0 13,0" id="Fill-5" fill="#000000"></path>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 969 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,78 +0,0 @@
{% load static %}
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Horaires en gare de {{ stop.name }}</title>
<link title="Dark mode" rel="stylesheet" href="{% static "bootstrap-sncf.darkmode.min.css" %}">
<script src="{% static "bootstrap-sncf.min.js" %}"></script>
</head>
<body>
<h1>Horaires en gare de {{ stop.name }}</h1>
<form>
<div class="row">
<div class="col-auto">
<label for="date">Afficher le tableau à un autre moment</label>
</div>
<div class="col-auto">
<input name="date" type="date" class="form-control" value="{{ query_date|date:"Y-m-d" }}">
</div>
<div class="col-auto">
<input name="time" type="time" class="form-control form-inline" value="{{ query_time|time:"H:i" }}">
</div>
<div class="col-auto">
<input type="submit" class="form-control form-inline">
</div>
</div>
</form>
<table class="table table-striped table-hover">
<thead>
<tr>
<th class="px-3 py-1" colspan="2">Train</th>
<th class="px-3 py-1">Heure</th>
<th class="px-3 py-1">Destination</th>
</tr>
</thead>
<tbody>
{% for departure in next_departures %}
<tr class="h-100">
<td class="h-100">
<div class="train-type d-flex h-100 align-items-center justify-content-center">
<div class="transilien-route d-flex align-items-center justify-content-center font-weight-bold small p-1 m-2 text-center text-wrap"
style="width: 4em; height: 4em; border-radius: 15%; background-color: #{{ departure.trip.color|default:"FFFFFF" }}; color: #{{ departure.trip.text_color|default:"000000" }};">
{{ departure.trip.train_type }}
</div>
</div>
</td>
<td class="h-100">
<div class="train-number d-flex align-items-center justify-content-center h-100">
<div>
{% if departure.trip.service.transport_type == "TN" %}
<div class="text-center">{{ departure.trip.headsign }}</div>
{% endif %}
<div>{{ departure.trip.train_number }}</div>
</div>
</div>
</td>
<td>
<div class="table-hour d-flex align-items-center justify-content-center text-warning font-weight-bold h-100">
{{ departure.pretty_departure_time }}
</div>
</td>
<td>
<h3 class="headline">{{ departure.trip.destination.name }}</h3>
<span class="stops">
{% for trip_stop in departure.trip.stop_times.all %}{% if trip_stop.stop_sequence > departure.stop_sequence %}{% if trip_stop.drop_off_type == 0 %}{{ trip_stop.stop.name }}{% if trip_stop.stop != departure.trip.destination %}, {% endif %}{% endif %}{% endif %}{% endfor %}
</span>
</td>
</tr>
{% endfor %}
</table>
</body>
</html>

View File

@ -1,7 +0,0 @@
from django.urls import path
from sncfgtfs import views
urlpatterns = [
path('gare/<str:gare>/', views.GareView.as_view(), name='gare'),
]

View File

@ -1,83 +0,0 @@
from datetime import date, datetime, time, timedelta
from django.db.models import Q, F
from django.views.generic import TemplateView
from sncfgtfs.models import Stop, StopTime, CalendarDate, Calendar
class GareView(TemplateView):
template_name = "sncfgtfs/gare.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
stop = Stop.objects.filter(name__iexact=kwargs["gare"], location_type=1).first()
context['stop'] = stop
next_departures = []
now = datetime.now()
if self.request.GET.get('date', None):
query_date = date.fromisoformat(self.request.GET['date'])
else:
query_date = now.date()
if self.request.GET.get('time', None):
query_time = time.fromisoformat(self.request.GET['time'])
else:
query_time = now.time()
context['query_date'] = query_date
context['query_time'] = query_time
query_time = query_time.isoformat(timespec='seconds')
query_time = timedelta(seconds=int(query_time[:2]) * 3600 + int(query_time[3:5]) * 60 + int(query_time[6:]))
yesterday = query_date - timedelta(days=1)
time_yesterday = query_time + timedelta(days=1)
tomorrow = query_date + timedelta(days=1)
qs = StopTime.objects.annotate(departure_time_24h=F('departure_time')).none()
for child in Stop.objects.filter(name__iexact=kwargs["gare"], location_type=0).all():
qs_child = StopTime.objects.filter(stop=child, pickup_type=0)
qs_child_tod = qs_child.filter(Q(departure_time__gte=query_time) &
(Q(trip__service_id__in=CalendarDate.objects.filter(
date=query_date, exception_type=1).values_list('service_id'))
| Q(trip__service_id__in=Calendar.objects.filter(
start_date__lte=query_date,
end_date__gte=query_date,
**{f"{query_date:%A}".lower(): True})
.filter(~Q(id__in=CalendarDate.objects.filter(
date=query_date, exception_type=2)
.values_list('service_id')))
.values_list('id')))) \
.annotate(departure_time_24h=F('departure_time'))
qs_child_yes = qs_child.filter(Q(departure_time__gte=time_yesterday) &
(Q(trip__service_id__in=CalendarDate.objects.filter(
date=yesterday, exception_type=1).values_list('service_id'))
| Q(trip__service_id__in=Calendar.objects.filter(
start_date__lte=yesterday,
end_date__gte=yesterday,
**{f"{yesterday:%A}".lower(): True})
.filter(~Q(id__in=CalendarDate.objects.filter(
date=yesterday, exception_type=2)
.values_list('service_id')))
.values_list('id')))) \
.annotate(departure_time_24h=F('departure_time') - timedelta(days=1))
qs_child_tom = qs_child.filter(Q(departure_time__gte=timedelta(0)) &
(Q(trip__service_id__in=CalendarDate.objects.filter(
date=tomorrow, exception_type=1).values_list('service_id'))
| Q(trip__service_id__in=Calendar.objects.filter(
start_date__lte=tomorrow,
end_date__gte=tomorrow,
**{f"{tomorrow:%A}".lower(): True})
.filter(~Q(id__in=CalendarDate.objects.filter(
date=tomorrow, exception_type=2)
.values_list('service_id')))
.values_list('id')))) \
.annotate(departure_time_24h=F('departure_time') + timedelta(days=1))
qs_child = qs_child_tod.union(qs_child_yes).union(qs_child_tom)
qs = qs.union(qs_child)
next_departures += qs.order_by("departure_time_24h")[:20].all()
context['next_departures'] = next_departures
return context