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

Update models.py #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update models.py #5

wants to merge 1 commit into from

Conversation

gtauanearu
Copy link

@gtauanearu gtauanearu commented Aug 13, 2022

I am adding the user_email address field in the person models!

Ticket: https://trello.com/c/yFlGRZY6/9-15-add-email-address-and-gender-to-person-model

@wsot
Copy link
Contributor

wsot commented Aug 14, 2022

That's great @gtauanearu - thanks!

I've added one comment.

After you've made a database change, you need to run python manage.py makemigrations to create the 'migration' file for the database change. Then in GitHub Desktop you can add that migration file and commit the change! (You'll want to make any more changes to the model.py file before you use the makemigrationsthough).

One other thing I haven't mentioned during sessions is running black . (that's black followed by a space and full stop) to run the Black code formatter. That will just adjust things like spaces after commas etc so they are all consistent.

If you can do those things, commit them, and push them up that would be great!

@@ -6,3 +6,5 @@ class Person(models.Model):
last_name = models.CharField(max_length=100, blank=True)
country = models.CharField(max_length=100, blank=True)
mobile_number = models.CharField(max_length=20, blank=True)
user_email = models.EmailField(max_length=70,blank=True,unique=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the commit!

issue (blocking): if the field is marked as able to be blank, then the unique rule will mean only one user can have a blank email. For now, can you remove the unique=True please?
I would also suggest extending the length to 256 from 70 (as that is the maximum length that an email server will accept for an email address. I should have included that detail in the ticket)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants