Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/django-storages-boto3--1.14.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ikarius committed Jul 29, 2024
2 parents 70639da + 918038c commit 09e7078
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 2 deletions.
3 changes: 1 addition & 2 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
"OPTIONS": {
# TODO: passer à 12
"min_length": 9,
"min_length": 12,
},
},
{
Expand Down
10 changes: 10 additions & 0 deletions dora/orientations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ class OrientationAdmin(admin.ModelAdmin):
"prescriber_structure",
"service",
)
readonly_fields = ("service", "di_service")
search_fields = (
"beneficiary_last_name",
"beneficiary_email",
"referent_last_name",
"referent_email",
"original_service_name",
"di_structure_name",
"di_service_name",
)
date_hierarchy = "creation_date"
ordering = ("-id",)
readonly_fields = ("query_id", "query_expires_at", "original_service_name")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.2.12 on 2024-07-15 16:53

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("orientations", "0009_orientation_query_expires_at_and_more"),
]

operations = [
migrations.AddConstraint(
model_name="orientation",
constraint=models.CheckConstraint(
check=models.Q(
models.Q(
("service", None),
models.Q(("di_service_id", ""), _negated=True),
),
models.Q(
models.Q(("service", None), _negated=True),
("di_service_id", ""),
),
_connector="OR",
),
name="check_valid_service",
),
),
]
12 changes: 12 additions & 0 deletions dora/orientations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ class Orientation(models.Model):
)
last_reminder_email_sent = models.DateTimeField(blank=True, null=True)

class Meta:
constraints = (
# service lié à l'orientation : DORA ou D·I, mais pas les deux
models.CheckConstraint(
check=(
(models.Q(service=None) & ~models.Q(di_service_id=""))
| (~models.Q(service=None) & models.Q(di_service_id=""))
),
name="check_valid_service",
),
)

def save(self, *args, **kwargs):
if not self.id:
self.original_service_name = self.get_service_name()
Expand Down
23 changes: 23 additions & 0 deletions dora/structures/migrations/0071_structure_putative_members.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.12 on 2024-07-15 13:45

from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("structures", "0070_alter_structure_phone"),
]

operations = [
migrations.AddField(
model_name="structure",
name="putative_members",
field=models.ManyToManyField(
related_name="putative_structure_set",
through="structures.StructurePutativeMember",
to=settings.AUTH_USER_MODEL,
),
),
]
3 changes: 3 additions & 0 deletions dora/structures/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ class Structure(ModerationMixin, models.Model):
data_inclusion_source = models.TextField(blank=True, db_index=True)

members = models.ManyToManyField(User, through=StructureMember)
putative_members = models.ManyToManyField(
User, through=StructurePutativeMember, related_name="putative_structure_set"
)

disable_orientation_form = models.BooleanField(default=False)

Expand Down
6 changes: 6 additions & 0 deletions dora/users/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class UsersConfig(AppConfig):
name = "dora.users"
verbose_name = "utilisateurs"

0 comments on commit 09e7078

Please sign in to comment.