My bet is that FullProfile.objects.get is raising the error because there is no profile with that email address. You might expect this to be caught by the "try" and raise a validation error instead, but since you have no "except" clause, its not going to happen.
On Wed, Jul 7, 2010 at 1:22 PM, Nick <nickt...@gmail.com> wrote: > I am working on a form to resend an account activation email for newly > registered users who did not receive their first email. > > The form is currently raising a DoesNotExist error and I can't figure > out why: > > Here is the activation code: > > class resend_activation(forms.Form): > email = forms.EmailField(label="E-Email") > > def clean_email(self): > email = self.cleaned_data["email"] > > try: > FullProfile.objects.get(email=email) > except FullProfile.DoesNotExist: > > test = > FullProfile.objects.get(email=self.cleaned_data['email']) > raise forms.ValidationError("%s" % (test)) > > def send(self): > email = self.cleaned_data['email'] > user = FullProfile.objects.get(email=email) > thread = Thread(target=send_activation, args=[user]) > thread.setDaemon(True) > thread.start() > > Here is the view: > > def resend(request): > if request.method == 'POST': > form = resend_activation(request.POST) > if form.is_valid(): > resend = form.send() > > > return HttpResponseRedirect("../activate_message") > else: > form = resend_activation() > > return render_to_response("registration/resend.html", {'form': > form }) > > Everytime I try to use the form I get a "FullProfile matching query > does not exist." error. But in the above code I added a little test to > see if the query was returning any values and it is. I have no clue > why this portion of process is holding up everything else. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.