-
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
Résolution de soucis mineurs d'héritage de classes #616
Changes from all commits
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 |
---|---|---|
|
@@ -79,18 +79,14 @@ def dispatch(self, request, *args, **kwargs): | |
|
||
|
||
class LateStageRequestView(VerifiedEmailIssuerView, View): | ||
@property | ||
def step(self) -> HabilitationFormStep: | ||
raise NotImplementedError() | ||
|
||
def setup(self, request, *args, **kwargs): | ||
super().setup(request, *args, **kwargs) | ||
self.organisation = get_object_or_404( | ||
OrganisationRequest, uuid=kwargs.get("uuid"), issuer=self.issuer | ||
) | ||
|
||
|
||
class OnlyNewRequestsView(LateStageRequestView): | ||
class OnlyNewRequestsView(HabilitationStepMixin, LateStageRequestView): | ||
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. Comme ces vues concernent seulement des brouillons, on a forcément un formulaire donc on s'attend à un fil d'Ariane => on peut hériter directement du habilitationstepmixin au lieu de dupliquer la logique 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. Hmm du coup l'IDE râle qu'on n'implémente pas la méthode abstraite. Pas moyen de déclarer que la classe est abstraite sans dupliquer le 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. Bah l'IDE propoe aussi de rajouter 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. Après, ça sert à rien de multiplier les classes abstraites à 1 méthode. Moi mon but à la base c'était surtout d'avoir 1 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. Le problème à la base c'est qu'on est loin d'avoir un fil d'ariane dans toutes les view, donc à mon avis ça n'avait pas grand intérêt de sortir un mixin pour ça. 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. les CBV sont globalement un nids a mixin :) C'est même parfois un reproche qui leur ait fait. 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. par contre j'ai pas fini mon deuxieme café, je viens de voir que le sujet était les décorateurs ! c'est aussi possible sur les CBV, un peu plus compliqué que juste sur des fonctions, mais oui ça se fait |
||
@property | ||
def step(self) -> HabilitationFormStep: | ||
raise NotImplementedError() | ||
|
@@ -287,7 +283,7 @@ def get_form_kwargs(self): | |
return {**super().get_form_kwargs(), "instance": self.organisation} | ||
|
||
|
||
class PersonnelRequestFormView(OnlyNewRequestsView, HabilitationStepMixin, FormView): | ||
class PersonnelRequestFormView(OnlyNewRequestsView, FormView): | ||
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. Et ici et sur la suivante, comme OnlyNewRequestsView hérite de HabilitationStepMixin, pas besoin de le rappeler ici |
||
template_name = "personnel_form.html" | ||
form_class = PersonnelForm | ||
|
||
|
@@ -338,7 +334,7 @@ def get_success_url(self): | |
) | ||
|
||
|
||
class ValidationRequestFormView(OnlyNewRequestsView, HabilitationStepMixin, FormView): | ||
class ValidationRequestFormView(OnlyNewRequestsView, FormView): | ||
template_name = "validation_form.html" | ||
form_class = ValidationForm | ||
|
||
|
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.
Ces vues peuvent concerner des formulaires ou non, donc pas forcément besoin de fil d'Ariane => pas de step attendu, pas d'héritage de habilitationstep