On Sat, May 16, 2009 at 4:49 PM, zayatzz <alan.kesselm...@gmail.com> wrote:

>
> Hello
>
> Been trying to figure out where the problem is, but its almost 1am and
> im out of ideas.
>
> i have this model:
> class tuser (models.Model):
>        username = models.CharField(max_length=20, help_text="Enter Username
> of your account")
>        email = models.EmailField(max_length=100, help_text="Enter your e-
> mail address", unique=True)
>        pwd = models.CharField(max_length=100, help_text="Enter your
> password")
>        active = models.SmallIntegerField(help_text="Different states of
> activity - inactive, active...")
>        joined = models.DateField(help_text="Date when registered")
>        llogin = models.DateField(help_text="Date of last activity",
> null=True)
>
> then i have this form:
> class RegisterForm(ModelForm):
>    class Meta:
>        model = tuser
>        fields = ('email')
>
> this is the view that handles the post:
> def regattempt(request):
>        if request.method == 'POST':
>                form = RegisterForm(request.POST)
>                if form.is_valid():
>                        p = tuser(username=form.email, email=form.email,
> pwd=randompass
> (12), active = 1, joined = datetime.datetime.now())
>                        p.save()
>        else:
>                form = RegisterForm()
>        return render_to_response('authprof/register.html', {
>                'form': form,
>        })
>
> i've been trying to follow different examples like :
>
> http://docs.djangoproject.com/en/1.0/topics/forms/#processing-the-data-from-a-form
>
> The error i get is :
> 'RegisterForm' object has no attribute 'email'
>
> Request Method:         POST
> Request URL:    http://127.0.0.1/account/register/regattempt/
> Exception Type:         AttributeError
> Exception Value:
>
> 'RegisterForm' object has no attribute 'email'
>
> Exception Location:     /home/projects/tst/authprof/views.py in
> regattempt, line 47
>
> line 47 is the p = tuser(so-on and so-forth....
>
> If anyone can explain me where this error comes from i would be very
> happy.
>
> Alan
> >
>
The issue is ('email') is  a string, and you need a tuple there, so it
should have a comma: ('email',)

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to