-
Notifications
You must be signed in to change notification settings - Fork 22
Add support for registering users to various campaigns #1526
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
Conversation
013518a to
e127106
Compare
users/models.py
Outdated
| def __str__(self): | ||
| return f"{self.user.username}({self.key})" |
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.
optional:
make the string include the Model type unless the keys always make it super obvious
lsabor
left a comment
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.
I looked over the front end and didn't see anything glaring, though not my area of expertise.
Back end looks good to me.
ncarazon
left a comment
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.
Left a comment to double-check. Though, I assume you've tested and redirect actually works fine, so I'm approving
| </> | ||
| ); | ||
| } else if (user) { | ||
| redirect("register"); |
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.
Double-checking, is this a valid redirect? As far as I can see, we on't have /register route
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.
Tested and works, it's a relative path
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.
Apologies, I see the register route now. I must have missed it during my previous review for some reason.
users/models.py
Outdated
| key = models.CharField( | ||
| max_length=200, | ||
| blank=True, | ||
| null=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.
Let's use null=False for required Char values to avoid headache with null vs empty string states
| ProjectUserPermission.objects.create( | ||
| user=user, project=project, permission=ObjectPermission.FORECASTER | ||
| ) |
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.
Do we have any checks whether user is allowed to join given project? Otherwise, you can specify id of a private project and enroll yourself into
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.
Good point, I will limit this to non-private projects
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.
Could you please also check signup_api_view as well? It also has add_to_project
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.
I am using that too, but this is for users that already have an account and they need to register to a campaign
5cbb729 to
0d4df5f
Compare
0d4df5f to
ab6014c
Compare
ab6014c to
78d2fa9
Compare
78d2fa9 to
a10db73
Compare
This adds support for registering users to the different campaigns we might have, and at the same time add them to a proejct as well, if needed. The registration collects information about the user which can be different from the campaign to campaign. That information is very unlikely to be used on actual site features, hence it was added it as a JSON: flexible and unlikely to cause issues with queries (either because of complexity or performance).