Re: Use object (User and custom object) in a form
I think you have a *namespace* problem.
> and finally my forms.py :
>
>from django import forms
>from django.contrib.auth.models import User
>
> > Error was: 'module' object
> > has no attribute 'User'
#--------------------------------------
You are importing everything in "django/forms/" into your namespace as
"forms.*", which comes from the installed files
django/forms/
widgets.py
fields.py
forms.py
models.py
None of those define 'User'
> my forms.py
>class CommentForms (forms.Form):
> cf_comment = forms.CharField()
> cf_writer = forms.User() <----- problem
That line says "make a new object called cf_writer using the User
class defined in the django forms module.
--
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