Open
Conversation
garg3133
reviewed
Feb 12, 2022
AlumniConnect/views.py
Outdated
| # CREATING THE USER FROM THE MODEL FORM DATA | ||
| user = form.save(commit=False) | ||
| user.username = form.cleaned_data.get('username') | ||
| user.email = str(form.cleaned_data.get('email')) |
Member
There was a problem hiding this comment.
I guess you do not need to do this (above two lines). It is already taken care of by django forms. So, if you keep is_active=False as default, you can just do form.save() here?
AlumniConnect/views.py
Outdated
| request.user.first_name = first_name | ||
| request.user.last_name = last_name | ||
| request.user.is_active = False | ||
| profile.save() |
Member
There was a problem hiding this comment.
Instead of adding all this information manually, why not just do form.save() here?? You can use reg_no_gen first thing after if request.method == 'POST', something like request.POST['reg_no'] = reg_no_gen(...).
applications/alumniprofile/models.py
Outdated
|
|
||
| class Batch(models.Model): | ||
| # batch = models.IntegerField(primary_key=True,choices=Constants.BATCH_OF,default=2009) |
| class Batch(models.Model): | ||
| # batch = models.IntegerField(primary_key=True,choices=Constants.BATCH_OF,default=2009) | ||
| batch = models.IntegerField(primary_key=True) | ||
|
|
Member
There was a problem hiding this comment.
Don't remove newlines like this. It reduces readability of the code.
applications/alumniprofile/models.py
Outdated
| roll_no = models.IntegerField(primary_key=True) | ||
| email = models.EmailField(null=False, default="") | ||
| alternate_email = models.EmailField(null=True, blank=True) | ||
| roll_no = models.CharField(primary_key=True,max_length=8) |
Member
There was a problem hiding this comment.
Don't assume that the max_length will always be 8 only, keep it 10 or 15
053b581 to
9d538ed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New signup workflow.