Skip to content

Commit

Permalink
job_seekers_views: required parameters for Update views
Browse files Browse the repository at this point in the history
In Update views, we don't need the company, but for the sake of clarity
we now need a `from_url` so that this value can be set in one less place.
  • Loading branch information
EwenKorr committed Jan 13, 2025
1 parent 0693555 commit eab1e29
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 1,821 deletions.
2 changes: 1 addition & 1 deletion itou/templates/apply/submit/application/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1 class="mb-0 me-3 text-md-nowrap">{% include 'apply/includes/_submit_title.ht
<p>
Dernière actualisation du profil : {{ job_seeker.last_checked_at|date }} à {{ job_seeker.last_checked_at|time }}
{% if can_view_personal_information and not request.user.is_job_seeker %}
<a class="btn-link ms-3" href="{% url "job_seekers_views:update_job_seeker_start" %}{% querystring job_seeker=job_seeker.public_id company=siae.pk from_url=request.get_full_path|urlencode %}">Vérifier le profil</a>
<a class="btn-link ms-3" href="{% url "job_seekers_views:update_job_seeker_start" %}{% querystring job_seeker=job_seeker.public_id from_url=request.get_full_path|urlencode %}">Vérifier le profil</a>
{% endif %}
{% if new_check_needed %}<i class="ri-information-line ri-xl text-warning"></i>{% endif %}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ <h1 class="mb-0 me-3 text-md-nowrap">Informations personnelles de {{ job_seeker.
<div class="c-box my-4">
<h2>
Informations personnelles
<a class="btn btn-outline-primary float-end"
href="{% url "job_seekers_views:update_job_seeker_start" %}{% querystring job_seeker=job_seeker.public_id company=siae.pk from_url=request.get_full_path|urlencode %}">Mettre à jour</a>
<a class="btn btn-outline-primary float-end" href="{% url "job_seekers_views:update_job_seeker_start" %}{% querystring job_seeker=job_seeker.public_id from_url=request.get_full_path|urlencode %}">Mettre à jour</a>
</h2>

{% include "apply/includes/profile_infos.html" %}
Expand Down
10 changes: 3 additions & 7 deletions itou/www/job_seekers_views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,12 +775,9 @@ def setup(self, request, *args, **kwargs):
except ValidationError:
raise Http404("Aucun candidat n'a été trouvé")

try:
company = get_object_or_404(Company.objects.with_has_active_members(), pk=request.GET.get("company"))
except ValueError:
raise Http404("Aucune entreprise n'a été trouvée")

from_url = get_safe_url(request, "from_url", fallback_url=reverse("dashboard:index"))
from_url = get_safe_url(request, "from_url")
if not from_url:
raise Http404

if request.user.is_job_seeker or not request.user.can_view_personal_information(job_seeker):
raise PermissionDenied("Votre utilisateur n'est pas autorisé à vérifier les informations de ce candidat")
Expand All @@ -790,7 +787,6 @@ def setup(self, request, *args, **kwargs):
data={
"config": {"from_url": from_url, "session_kind": "job-seeker-update"},
"job_seeker_pk": job_seeker.pk,
"apply": {"company_pk": company.pk},
},
)

Expand Down
Loading

0 comments on commit eab1e29

Please sign in to comment.