Skip to content
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

Reduce hardcoding of consent labels in UI #2361

Conversation

elichad
Copy link
Contributor

@elichad elichad commented Mar 15, 2023

Fixes #2302 .

Also propose updating the content field of the public-profile consent to "Do you consent to publish your profile
on The Carpentries website?" in the AMY Django admin interface.

Copy link
Contributor

@pbanaszkiewicz pbanaszkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments where I'm not sure the solution is needed, but hey I may be wrong so let's have a discussion :) The rest looks good.

migrations.AddField(
model_name="term",
name="short_description",
field=models.CharField(null=True, max_length=100),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to create the field with "" as default value, therefore there should be no need switch null=True and then null=False in a migration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't you then have to do the same thing with blank=True and blank=False instead? I don't think we want this field to be permitted to be blank as it may appear in the UI through lines like this https://github.com/carpentries/amy/pull/2361/files#diff-a97c97acc5cd76b1c48999bacdc2b399b62f678806ab48b559dcc0944c366536R278

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think blank is only applied when creating model instances. You definitely should be fine if you provide one-off value for the migration (default value of ""). makemigrations may even ask you for it.

@@ -37,15 +37,15 @@
</th><td>{{ user.secondary_email|default:"—" }}</td></tr>
<tr><th>Gender:</th><td>{{ user.get_gender_display }}{{ user.gender_other }}</td></tr>
<tr>
<th>Can we contact you?</th>
<th>{{ consents_content.may_contact }}</th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same as consents.public_profile.term.content? If yes, then I'm not sure we need consents_content object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content is the same, but if the user hasn't set that consent, consents.public_profile won't exist.

@pbanaszkiewicz pbanaszkiewicz added this to the v4.1 milestone Mar 18, 2023
@pbanaszkiewicz pbanaszkiewicz added this to In progress in Consents via automation Mar 18, 2023
@elichad
Copy link
Contributor Author

elichad commented Mar 31, 2023

Merging now. I've also made that change to the content of public-profile as suggested in the initial comment.

@elichad elichad merged commit bb6b175 into develop Mar 31, 2023
6 checks passed
Consents automation moved this from In progress to Done Mar 31, 2023
@elichad elichad deleted the feature/2302-Consents-add-admin-field-text-representation-of-a-consent-term branch August 2, 2023 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Consents: add admin field text representation of a consent term
2 participants