-
Notifications
You must be signed in to change notification settings - Fork 52
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
Archive Item Titles #3345
Archive Item Titles #3345
Conversation
The Django test seemed to fail randomly on not being able to find the Merging main and re-running. |
Well, Chris of the past, that worked! |
Draft, since I am in the middle of a refactor. |
Heavy refactor. I've now pushed the processing of the data into the forms, leaning more heavily on the model's definition of civ_set. I think this is the DRY-est it has been. For instance, the forms for DisplaySet creating and updating are now an interesting mix of Mixins: class DisplaySetCreateForm(
DisplaySetFormMixin,
UniqueTitleCreateFormMixin,
CIVSetCreateFormMixin,
MultipleCIVForm,
):
pass
class DisplaySetUpdateForm(
DisplaySetFormMixin,
UniqueTitleUpdateFormMixin,
CIVSetUpdateFormMixin,
MultipleCIVForm,
):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if not self.instance.is_editable:
for _, field in self.fields.items():
field.disabled = True |
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.
LGTM!
Fixes bug introduced in #3345 which made archive items uneditable.
Part of the pitch:
This is a copy of what was done for Display Items. I've opted to abstract the CIV set creation and update form data processing into
CIVSetCreateViewMixin
andCIVSetCreaViewMixin
respectively as to stay DRY.