Re: __init__() got an unexpected keyword argument 'city'
On Jul 25, 10:23 am, Showket Bhat <scorpion.sch...@gmail.com> wrote:
> Hi I am facing this problim from few days..tried a lot to correct it
> but everytime i failed..Please Help...
>
> I have created a simple form to store few field values in my
> database.. It was working until i used the forms.py.. when i developed
> this with forms.py i got this error
>
> __init__() got an unexpected keyword argument 'city'
>
> Now i removed the forms.py but it still shows the same error.. But i
> want to learn forms so how could i correct it ..Thanks in advance
>
> ===============
> forms.py
> ===============
>
> from django import forms
>
> class Student(forms.Form):
Would probably benefit from a better naming... Something like
StudentForm. Also you could use a ModelForm...
(snip)
>
> ==========================
> views.py
> ==========================
(snip)
> from school.student.models import *
> from school.student.forms import *
(snip)
You a have "Student" model class in student.models, don't you ? Now
guess what the name "Student" is bound to at this point - your model
or your form ?
As a general rule, "from <module> import *" is a bad practice, as it
leads to this kind of problems - one name shadowing another.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home