-
Notifications
You must be signed in to change notification settings - Fork 1
Add HeaProfileViewSet and UserViewSet api endpoints see HEA-580 #130
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
Add HeaProfileViewSet and UserViewSet api endpoints see HEA-580 #130
Conversation
hea/urls.py
Outdated
| router.register(r"unitofmeasure", UnitOfMeasureViewSet) | ||
| router.register(r"classifiedproduct", ClassifiedProductViewSet) | ||
| router.register(r"user", UserViewSet) | ||
| router.register(r"heaprofile", HeaProfileViewSet) |
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.
@girumb I think i would prefer if this was /userprofile, and the model was UserProfile, etc. It is in common so it is not supposed to be specific. It's too late for FDW now, but I would like a model that we can just copy without changes into the next application we build.
apps/common/models.py
Outdated
|
|
||
| class HeaProfile(Model): | ||
| """ | ||
| A profile to store data associated with a user to be used by the Livelihoods Explorer |
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.
A profile to store data associated with a user to enable a customized user experience.
apps/common/models.py
Outdated
| """ | ||
|
|
||
| user = models.OneToOneField(User, on_delete=CASCADE, primary_key=True, unique=True) | ||
| expert = models.BooleanField(default=False) |
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.
@Jake-Stoll do you need expert, skip_tour and tour_last_viewed as concrete fields in the HEA user profile? Will we have a tour or an expert mode? If we do, would they be better implemented as part of the JSON structure?
apps/common/models.py
Outdated
| expert = models.BooleanField(default=False) | ||
| skip_tour = models.BooleanField(default=False) | ||
| tour_last_viewed = models.DateField(null=True) | ||
| livelihood_explorer_data = models.JSONField(default=dict, null=True, blank=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.
user_data = models.JSONField(default=dict, null=True, blank=True, verbose_name=_("user data"))
apps/common/models.py
Outdated
| livelihood_explorer_data = models.JSONField(default=dict, null=True, blank=True) | ||
|
|
||
| def __str__(self): | ||
| return f"hea_profile: {str(self.user)}" |
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.
return f"user_profile: {str(self.user)}"
…PR feedback see HEA-580
…PR feedback see HEA-580
…oints-similar-to-the-FDW-ones
No description provided.