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

1104 add useraffiliation to the base user model #1126

Merged
merged 9 commits into from
Dec 4, 2024

Conversation

jchate6
Copy link
Contributor

@jchate6 jchate6 commented Nov 23, 2024

This is the basis for code to add profile information to a User for tom_base.

Current issues:

  • If Users already exist without an associated profile, the profile page will break.
  • The Profile model should be able to be overwritten by a User
  • Profile Fields are not properly displayed on the profile page via "verbose name"

Solutions to nonexistant profiles:

  • Catch RelatedObjectDoesNotExist: User has no profile. error and create profile.
    • If we want to use the signals, we can do this in save_profile. This has the benefit of causing every new user to automatically have a profile, and updating all old ones automatically as they log in. Downside is using signals which adds new code.
    • Otherwise we create the new profile when accessing the profile page in user_extras. Has the benefit of no "new" code, but feels like the wrong place for this type of functionality.
  • Allow users to not have profiles:
    • Build all code under the assumption that some users do not have profiles. Seems hard and surprising for users who want to access profile information for themselves in custom code.
  • Use signals and add management command that needs to be run to create profiles for existing users when updating to new version. Seems like an unnecessary burden on users.

@jchate6 jchate6 linked an issue Nov 23, 2024 that may be closed by this pull request
@@ -38,6 +38,8 @@ def test_user_list(self):

def test_user_create(self):
user_data = {
'profile-TOTAL_FORMS': '1',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We changed the user creation form to a formset, so we need to include the profile ManagementForm data here or it will get angry.

@jchate6 jchate6 requested a review from phycodurus December 4, 2024 18:50
@jchate6 jchate6 marked this pull request as ready for review December 4, 2024 18:50
@jchate6
Copy link
Contributor Author

jchate6 commented Dec 4, 2024

I'm pretty pleased with the state of this PR.
If you approve I'll push off the unchecked item above (exposing the profile to be customized by users) to a future issue.
It might make it into this sprint, depending on how the Demo App work goes.

@jchate6 jchate6 merged commit f4ee27a into dev Dec 4, 2024
25 checks passed
@jchate6 jchate6 deleted the 1104-add-useraffiliation-to-the-base-user-model branch December 4, 2024 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add UserAffiliation to the Base User Model
2 participants