Code

Opened 5 years ago

Closed 5 years ago

Last modified 5 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: UI/UX:

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 *

Attachments (0)

Change History (2)

comment:1 follow-up: Changed 5 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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.

comment:2 in reply to: ↑ 1 Changed 5 years ago by escopel

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.