Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 225541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:25:25+00:00 2026-05-11T19:25:25+00:00

I have an issue with the django.contrib.auth User model where the email max_length is

  • 0

I have an issue with the django.contrib.auth User model where the email max_length is 75.

I am receiving email addresses that are longer than 75 characters from the facebook api, and I need to (would really like to) store them in the user for continuity among users that are from facebook connect and others.

I am able to solve the problem of “Data truncated for column 'email' at row 1” by manually going editing the field in our mySql database, but is there a better way to solve this? preferably one that does not involve me manually editing the database every time I reset it for a schema change?

I am ok with editing the database as long as I can add it to the reset script, or the initial_data.json file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:25:25+00:00Added an answer on May 11, 2026 at 7:25 pm

    EmailField 75 chars length is hardcoded in django. You can fix this like that:

    from django.db.models.fields import EmailField
    def email_field_init(self, *args, **kwargs):
      kwargs['max_length'] = kwargs.get('max_length', 200)
      CharField.__init__(self, *args, **kwargs)
    EmailField.__init__ = email_field_init
    

    but this will change ALL EmailField fields lengths, so you could also try:

    from django.contrib.auth.models import User
    from django.utils.translation import ugettext as _
    from django.db import models
    User.email = models.EmailField(_('e-mail address'), blank=True, max_length=200)
    

    both ways it’d be best to put this code in init of any module BEFORE django.contrib.auth in your INSTALLED_APPS

    Since Django 1.5 you can use your own custom model based on AbstractUser model, therefore you can use your own fields & lengths.
    In your models:

    from django.contrib.auth.models import AbstractUser
    from django.db import models
    
    class User(AbstractUser):
        email = models.EmailField(_('e-mail address'), blank=True, max_length=200)
    

    In settings:

    AUTH_USER_MODEL = 'your_app.models.User'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a django application, using the basic userprofile extension of django.contrib.auth.user model. I
I have a strange issue here with my Django app. I implemented the user
I'm having an issue getting the django.contrib.auth unit tests shipped with Django (1.2.3-3+squeeze1) to
I am using Django 1.3 and have the following issue: In the Admin list
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have an issue that is driving me a bit nuts: Using a UserProfileManager
Hi Everyone I m dealing with some serious issue in django-admin.I have created models
I have a Django view that receives POSTs which do not need to have
So I have a django development server that I want to be the backend
I currently have a simple model defined, with a photoupload feature using django thumbnails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.