-
Notifications
You must be signed in to change notification settings - Fork 54
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
Refactor/signup #75
base: master
Are you sure you want to change the base?
Refactor/signup #75
Conversation
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')) |
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 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() |
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.
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) |
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.
remove this commented line.
batch = models.IntegerField(primary_key=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.
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) |
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.
Don't assume that the max_length will always be 8 only, keep it 10 or 15
053b581
to
9d538ed
Compare
New signup workflow.