-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #546 from MTES-MCT/staging
MEP 7.4
- Loading branch information
Showing
27 changed files
with
808 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{% extends "index.html" %} | ||
|
||
{% load static %} | ||
{% load sri %} | ||
|
||
{% block pagetitle %}Téléchargements{% endblock pagetitle %} | ||
|
||
{% block headers %} | ||
{% sri_static "home/css/home.css" %} | ||
{% endblock headers %} | ||
|
||
{% block body_class %}home{% endblock body_class %} | ||
|
||
<!-- Hide breadcrumbs on home page --> | ||
{% block breadcrumbs %} | ||
{% endblock breadcrumbs %} | ||
|
||
{% block content %} | ||
<section class="fr-py-6w"> | ||
<div class="fr-container"> | ||
<h1>Trames de rapport triennal local des communes au RNU</h1> | ||
<p> | ||
Mon Diagnostic Artificialisation met à disposition des DDT les trames de rapport triennal local par paquets de leurs communes au RNU | ||
</p> | ||
<div class="fr-table fr-table--bordered"> | ||
<div class="fr-table__wrapper"> | ||
<div class="fr-table__container"> | ||
<div class="fr-table__content fr-table--no-scrol"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th scope="col">Département</th> | ||
<th scope="col">Nombre de communes au RNU</th> | ||
<th scope="col">Date de création</th> | ||
<th scope="col">Lien</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for package in rnu_packages %} | ||
<tr> | ||
<td>{{ package.departement_official_id }} - {{ package.departement.name }}</td> | ||
<td>{{ package.communes|length }}</td> | ||
<td>{{ package.created_at }}</td> | ||
<td><a target="_blank" rel="noopener noreferrer" href="{% url 'home:download_rnu_package' package.departement.source_id %}">Lien de téléchargement</a></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{% include "home/partials/newsletter_form.html" %} | ||
{% endblock content %} | ||
|
||
{% block tagging %} | ||
<script language="javascript" nonce="[NONCE_PLACEHOLDER]"> | ||
window.onload = function(event) { | ||
_paq.push(['trackEvent', 'local_report_download_funnel', 'open_home_local_report', 'local_report_home_opened']) | ||
} | ||
</script> | ||
{% endblock tagging %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.2.13 on 2024-07-14 15:54 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("project", "0083_alter_historicalrequest_organism_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="RNUPackage", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("file", models.FileField(upload_to="rnu_packages/")), | ||
("created_at", models.DateTimeField(auto_now_add=True)), | ||
("updated_at", models.DateTimeField(auto_now=True)), | ||
("departement_official_id", models.CharField(max_length=10)), | ||
], | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
project/migrations/0085_alter_rnupackage_departement_official_id.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.13 on 2024-07-16 07:49 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("project", "0084_rnupackage"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="rnupackage", | ||
name="departement_official_id", | ||
field=models.CharField(max_length=10, unique=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.13 on 2024-07-16 08:00 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("project", "0085_alter_rnupackage_departement_official_id"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="rnupackage", | ||
name="app_version", | ||
field=models.CharField(default="", max_length=10), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.13 on 2024-07-16 08:26 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("project", "0086_rnupackage_app_version"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="rnupackage", | ||
name="file", | ||
field=models.FileField(upload_to="rnu_packages"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.13 on 2024-07-16 08:34 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("project", "0087_alter_rnupackage_file"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="rnupackage", | ||
name="file", | ||
field=models.FileField(blank=True, null=True, upload_to="rnu_packages"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Generated by Django 4.2.13 on 2024-07-18 12:14 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("project", "0088_alter_rnupackage_file"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="RNUPackageRequest", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("departement_official_id", models.CharField(max_length=10)), | ||
("email", models.EmailField(max_length=254)), | ||
("requested_at", models.DateTimeField(auto_now_add=True)), | ||
("requested_diagnostics_before_package_request", models.IntegerField()), | ||
("account_created_for_package", models.BooleanField()), | ||
( | ||
"rnu_package", | ||
models.ForeignKey( | ||
null=True, on_delete=django.db.models.deletion.SET_NULL, to="project.rnupackage" | ||
), | ||
), | ||
( | ||
"user", | ||
models.ForeignKey( | ||
null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL | ||
), | ||
), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from django.db import models | ||
from django.utils.functional import cached_property | ||
|
||
from public_data.models import Departement | ||
from public_data.models.sudocuh import DocumentUrbanismeChoices, Sudocuh | ||
|
||
|
||
class RNUPackage(models.Model): | ||
file = models.FileField(upload_to="rnu_packages", blank=True, null=True) | ||
app_version = models.CharField(max_length=10) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
departement_official_id = models.CharField( | ||
max_length=10, | ||
unique=True, | ||
) | ||
|
||
@cached_property | ||
def departement(self): | ||
return Departement.objects.get(source_id=self.departement_official_id) | ||
|
||
@cached_property | ||
def communes(self): | ||
sudocuh = Sudocuh.objects.filter(du_opposable=DocumentUrbanismeChoices.RNU) | ||
return self.departement.commune_set.filter( | ||
insee__in=sudocuh.values("code_insee"), | ||
) |
Oops, something went wrong.