-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fonctionnalités "attestation de service public" et "labellisation france services" #580
Changes from all commits
b60b339
64de5e5
c4196e2
a29f571
480129b
f1cf033
9342d69
38a21a2
8b713d1
8a84446
17e189b
faf5b1c
0550fef
47c8de7
fba1301
972edfd
cabd264
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
BooleanField, | ||
CharField, | ||
ChoiceField, | ||
FileField, | ||
modelformset_factory, | ||
) | ||
from django.forms.formsets import MAX_NUM_FORM_COUNT, TOTAL_FORM_COUNT | ||
|
@@ -96,14 +95,16 @@ class OrganisationRequestForm(PatchedErrorListForm): | |
}, | ||
) | ||
|
||
partner_administration = CharField( | ||
label="Renseignez l’administration avec laquelle vous travaillez", | ||
is_private_org = BooleanField( | ||
label=( | ||
"Cochez cette case si vous faites cette demande pour une structure privée " | ||
"(hors associations)" | ||
), | ||
required=False, | ||
) | ||
|
||
public_service_delegation_attestation = FileField( | ||
label="Téléversez ici une attestation de délégation de service public", | ||
help_text="Taille maximale : 2 Mo. Formats supportés : PDF, JPG, PNG.", | ||
partner_administration = CharField( | ||
label="Renseignez l’administration avec laquelle vous travaillez", | ||
required=False, | ||
) | ||
|
||
|
@@ -125,6 +126,20 @@ def __init__(self, **kwargs): | |
"data-other-value": RequestOriginConstants.OTHER.value, | ||
}, | ||
) | ||
self.widget_attrs( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Attributs ajoutés sur les checkbox pour la gestion du JS |
||
"is_private_org", | ||
{ | ||
"data-action": "change->dynamic-form#onIsPrivateOrgChange", | ||
"data-dynamic-form-target": "privateOrgInput", | ||
}, | ||
) | ||
self.widget_attrs( | ||
"france_services_label", | ||
{ | ||
"data-action": "change->dynamic-form#onFranceServicesChange", | ||
"data-dynamic-form-target": "franceServicesInput", | ||
}, | ||
) | ||
|
||
def clean_type(self): | ||
return OrganisationType.objects.get(pk=int(self.data["type"])) | ||
|
@@ -142,6 +157,30 @@ def clean_type_other(self): | |
|
||
return self.data["type_other"] | ||
|
||
def clean_partner_administration(self): | ||
if not self.data.get("is_private_org", False): | ||
return "" | ||
|
||
if not self.data["partner_administration"]: | ||
raise ValidationError( | ||
"Vous avez indiqué que la structure est privée : merci de renseigner " | ||
"votre administration partenaire." | ||
) | ||
|
||
return self.data["partner_administration"] | ||
|
||
def clean_france_services_number(self): | ||
if not self.data.get("france_services_label", False): | ||
return "" | ||
|
||
if not self.data["france_services_number"]: | ||
raise ValidationError( | ||
"Vous avez indiqué que la structure est labellisée France Services : " | ||
"merci de renseigner son numéro d’immatriculation France Services." | ||
) | ||
|
||
return self.data["france_services_number"] | ||
|
||
class Meta: | ||
model = models.OrganisationRequest | ||
fields = [ | ||
|
@@ -152,9 +191,10 @@ class Meta: | |
"address", | ||
"zipcode", | ||
"city", | ||
"is_private_org", | ||
"partner_administration", | ||
"public_service_delegation_attestation", | ||
"france_services_label", | ||
"france_services_number", | ||
"web_site", | ||
"mission_description", | ||
"avg_nb_demarches", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 3.2.12 on 2022-03-24 16:13 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('aidants_connect_habilitation', '0013_auto_20220321_0941'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='organisationrequest', | ||
name='france_services_number', | ||
field=models.CharField(blank=True, default='', max_length=200, verbose_name='Numéro d’immatriculation France Services'), | ||
), | ||
migrations.AddField( | ||
model_name='organisationrequest', | ||
name='is_private_org', | ||
field=models.BooleanField(default=False, verbose_name='Structure privée'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='organisationrequest', | ||
constraint=models.CheckConstraint(check=models.Q(models.Q(('is_private_org', True), ('partner_administration__isnull_or_blank', False)), models.Q(('is_private_org', False), ('partner_administration__isnull_or_blank', True)), _connector='OR'), name='partner_administration_if_org_is_private'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='organisationrequest', | ||
constraint=models.CheckConstraint(check=models.Q(models.Q(('france_services_label', True), ('france_services_number__isnull_or_blank', False)), models.Q(('france_services_label', False), ('france_services_number__isnull_or_blank', True)), _connector='OR'), name='immatriculation_number_if_france_services_label'), | ||
), | ||
] |
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,11 +103,7 @@ class OrganisationRequestFactory(DjangoModelFactory): | |
zipcode = FactoryFaker("postcode") | ||
city = FactoryFaker("city") | ||
|
||
partner_administration = FactoryFaker("company") | ||
|
||
public_service_delegation_attestation = "" | ||
|
||
france_services_label = FuzzyChoice([True, False]) | ||
france_services_label = False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. J'arrête les FuzzyChoice dans les factories, parce que ça fait des FuzzyTests après… Et déjà comme ça ce fut compliqué :D |
||
|
||
web_site = FactoryFaker("url") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En attendant de savoir comment on réimplémente la fonctionnalité, j'ai carrément supprimé le champ.