Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9450 closed (invalid)

error import field in forms.py

Reported by: escopel Owned by: nobody
Component: Forms Version: 1.0
Severity: Keywords: forms.py
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

example code :

from django.forms import forms

TOPIC_CHOISES = (('general', 'Generale'), ('bug', 'Bug'), ('suggestion','Suggestion'))

class ContactForm?(forms.Form):

topic = forms.ChoiceField?(choices = TOPIC_CHOISES) message = forms.CharField?() sender = forms.EmailField?(required = False)

error:

AttributeError?: 'module' object has no attribute 'ChoiceField?'

in forms.py line 12: from fields import Field, FileField?

not import all fileds but only Field and FileField?

i have changed in :

from fields import *

Change History (2)

comment:1 by Karen Tracey, 16 years ago

Resolution: invalid
Status: newclosed

Your code has an error. Where you have:

from django.forms improt forms

you should have:

from django import forms

If you use the correct import in your code the change you propose to Django code is not necessary.

Also, for future reference please use WikiFormatting (there is a link to describe it right on the submission page) and the Preview button to format your examples and verify they display properly before submitting. What you actually posted is pretty unreadable.

in reply to:  1 comment:2 by escopel, 16 years ago

Replying to kmtracey:

Your code has an error. Where you have:

from django.forms improt forms

you should have:

from django import forms

If you use the correct import in your code the change you propose to Django code is not necessary.

thank you!

Also, for future reference please use WikiFormatting (there is a link to describe it right on the submission page) and the Preview button to format your examples and verify they display properly before submitting. What you actually posted is pretty unreadable.

Note: See TracTickets for help on using tickets.
Back to Top