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

  • SEARCH
  • Home
  • 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 6537469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:37:13+00:00 2026-05-25T10:37:13+00:00

from django import forms class UserForm(forms.ModelForm): first_name = forms.TextField(label=_(u’First name’), required=False) last_name = forms.TextField(label=_(u’Last

  • 0
from django import forms

class UserForm(forms.ModelForm):
    first_name = forms.TextField(label=_(u'First name'), required=False)
    last_name = forms.TextField(label=_(u'Last name'))

The code above gives me an "AttributeError: ‘module’ object has no attribute ‘TextField’.
Everything seems to be ok, except the missing TextField:

ipdb> forms
<module 'django.forms' from '/usr/local/lib/python2.7/dist-packages/django/forms/__init__.pyc'>
ipdb> forms.
forms.BaseForm                        forms.EmailField                      forms.MultiWidget                     forms.TypedChoiceField
forms.BaseModelForm                   forms.Field                           forms.MultipleChoiceField             forms.TypedMultipleChoiceField
forms.BooleanField                    forms.FileField                       forms.MultipleHiddenInput             forms.URLField
forms.CharField                       forms.FileInput                       forms.NullBooleanField                forms.ValidationError
forms.CheckboxInput                   forms.FilePathField                   forms.NullBooleanSelect               forms.Widget
forms.CheckboxSelectMultiple          forms.FloatField                      forms.PasswordInput                   forms.fields
forms.ChoiceField                     forms.Form                            forms.RadioSelect                     forms.fields_for_model
forms.ClearableFileInput              forms.HiddenInput                     forms.RegexField                      forms.forms
forms.ComboField                      forms.IPAddressField                  forms.Select                          forms.formsets
forms.DEFAULT_DATETIME_INPUT_FORMATS  forms.ImageField                      forms.SelectMultiple                  forms.model_to_dict
forms.DEFAULT_DATE_INPUT_FORMATS      forms.IntegerField                    forms.SlugField                       forms.models
forms.DEFAULT_TIME_INPUT_FORMATS      forms.Media                           forms.SplitDateTimeField              forms.save_instance
forms.DateField                       forms.MediaDefiningClass              forms.SplitDateTimeWidget             forms.util
forms.DateInput                       forms.ModelChoiceField                forms.TextInput                       forms.widgets
forms.DateTimeField                   forms.ModelForm                       forms.Textarea                        
forms.DateTimeInput                   forms.ModelMultipleChoiceField        forms.TimeField                       
forms.DecimalField                    forms.MultiValueField                 forms.TimeInput          

Any idea?

  • 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-25T10:37:13+00:00Added an answer on May 25, 2026 at 10:37 am

    CharField might be what you are looking for.

    EDIT: To clarify, the docs mention TextField as a model field type. You cannot use it as form field. The table that the OP pointed out indicates that a TextField in a model is represented as a CharField (with widget=forms.Textarea) in a corresponding ModelForm. I would imagine, then, that there is no form field with Textarea as its default widget.

    If I were to guess why Django made this choice, I would say that having two fields that differ only in the widget they use, not in the type of data being stored, validation, etc. might be considered useless by the people at Django and hence you have to manually change the widget.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given: from django.db import models class Food(models.Model): Food, by name. name = models.CharField(max_length=25) class
Given a class: from django.db import models class Person(models.Model): name = models.CharField(max_length=20) Is it
I have a form in my forms.py that looks like this: from django import
I have a class Book : from django.db import models from users.models import User
I've got a couple django models that look like this: from django.contrib.sites.models import Site
The documentation is a bit lacking with respect to this feature. from django import
In Django, given excerpts from an application animals likeso: A animals/models.py with: from django.db
I am writing an application where I will be accessing the database from django
I need to perform a filtered query from within a django template, to get
What is the best idea to fill up data into a Django model from

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.