Re: View didn't return an HttpResponse object

2014-10-27 Thread Collin Anderson
Hello,

The messages framework might be helpful here.

from django.contrib import messages
messages.add_message(request, messages.INFO, 'Password was changed')
return logout_then_login(request, login_url='/login/')

 Logowanie na stronie Managera Piłkarskiego GoalKick 

{% for message in messages %}
{{ message }}
{% endfor %}

https://docs.djangoproject.com/en/dev/ref/contrib/messages/#using-messages-in-views-and-templates

Collin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cc51e6df-eca2-4e51-8cd8-c7622d362666%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-24 Thread Dariusz Mysior
I have in views.py

message="Password was changed"
return logout_then_login(request, login_url='/login/',extra_context={
'message': message})


And I want display this message in

login.html below

{% extends "base_site_dom.html" %}
{% block title %} - logowanie {% endblock %}
{%  block content %}

 Logowanie na stronie Managera Piłkarskiego GoalKick 

*{{ message}}*


{%  csrf_token %}
{{ form.as_p }}






{% endblock %}
{% block footer %}

Strona główna

{% endblock %}

What I do wrong, this message is not show :/

W dniu wtorek, 7 października 2014 20:37:49 UTC+2 użytkownik Dariusz Mysior 
napisał:
>
> I have form to change password like below, and when I try to display it I 
> have an bug:
>
> ValueError at /password_change/
>   
>
> The view dom.views.password_change_dom didn't return an HttpResponse object.
>
>
>   
>
> 
>   
>   
> 
> 
>   
>   
> 
>
> 
>   
>   
> 
>
> 
>
>   Request Method:GETRequest URL:
> http://darmys.pythonanywhere.com/password_change/Django 
> Version:1.6.5Exception 
> Type:ValueErrorException Value:
>
> The view dom.views.password_change_dom didn't return an HttpResponse object.
>
>
> My forms.py is:
> class FormularzPasswordChange(forms.Form):
> password1 = forms.CharField(label="Hasło:",widget=forms.PasswordInput
> ())
> password2 = forms.CharField(label="Powtórz hasło:",widget=forms.
> PasswordInput())
>
> def clean_password2(self):
> password1 = self.cleaned_data['password1']
> password2 = self.cleaned_data['password2']
> if password1 == password2:
> return password2
> else:
> raise forms.ValidationError("Hasła się różnią")
>
>
>
> urls.py
>
> url(r'^password_change/$', views.password_change_dom, name=
> 'change_password')
>
> change_password.html
>
> {% extends "base_site_dom.html" %}
>
> {% block title %} - zmiana hasła {% endblock %}
>
> {% block content %}
>
> 
> Zmiana hasła na nowe.
> Wpisz nowe hasło 2 razy.
> 
> 
> 
> {% csrf_token %}
> {{ form.as_p }}
>   value="Wartoci początkowe">
> 
> 
> 
> 
> {% endblock %}
> {% block footer %}
> 
> Strona głóna
> 
> {% endblock %}
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b8f21b6-ecbb-4912-a45b-f758b73fb5c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-21 Thread Dariusz Mysior
Thank You, once again it help :)

W dniu poniedziałek, 20 października 2014 23:55:28 UTC+2 użytkownik Collin 
Anderson napisał:
>
> Hello,
>
> from django.contrib.auth import logout,login,authenticate,password_change
> I think you want:
> from django.contrib.auth import logout,login,authenticate
> from django.contrib.auth.views import change_password
>
> Collin
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1b57667f-f4fc-4e85-9487-be337cf20c53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-20 Thread Collin Anderson
Hello,

from django.contrib.auth import logout,login,authenticate,password_change
I think you want:
from django.contrib.auth import logout,login,authenticate
from django.contrib.auth.views import change_password

Collin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4b5511cb-5777-4090-961b-5705fe1661e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-20 Thread Dariusz Mysior
Now I try change this part of code in views.py

#request.user.set_password(form.cleaned_data['password2'])
#request.user.save()
#return render(request, 
'registration/change_password_success.html', {'user': request.user})

On 

from django.contrib.auth import logout,login,authenticate,*password_change*
.
.
.

password_change(request,'registration/change_password_success.html',
post_change_redirect=None,
password_change_form=FormularzPasswordChange, 
current_app=None, extra_context=None)

urls.py

This change

#url(r'^password_change/$', views.password_change_dom, 
name='change_password'),


On this

url(r'^password_change/$', 'django.contrib.auth.views.change_password'),

And I have message on first site :/


ImportError at / 
>
> cannot import name password_change
>
>  Request Method: GET  Request URL: http://darmys.pythonanywhere.com/  Django 
> Version: 1.6.5  Exception Type: ImportError  Exception Value: 
>
> cannot import name password_change
>
>  Exception Location: /home/darmys/dom/dom/views.py in , line 7




W dniu wtorek, 7 października 2014 20:37:49 UTC+2 użytkownik Dariusz Mysior 
napisał:
>
> I have form to change password like below, and when I try to display it I 
> have an bug:
>
> ValueError at /password_change/
>   
>
> The view dom.views.password_change_dom didn't return an HttpResponse object.
>
>
>   
>
> 
>   
>   
> 
> 
>   
>   
> 
>
> 
>   
>   
> 
>
> 
>
>   Request Method:GETRequest URL:
> http://darmys.pythonanywhere.com/password_change/Django 
> Version:1.6.5Exception 
> Type:ValueErrorException Value:
>
> The view dom.views.password_change_dom didn't return an HttpResponse object.
>
>
> My forms.py is:
> class FormularzPasswordChange(forms.Form):
> password1 = forms.CharField(label="Hasło:",widget=forms.PasswordInput
> ())
> password2 = forms.CharField(label="Powtórz hasło:",widget=forms.
> PasswordInput())
>
> def clean_password2(self):
> password1 = self.cleaned_data['password1']
> password2 = self.cleaned_data['password2']
> if password1 == password2:
> return password2
> else:
> raise forms.ValidationError("Hasła się różnią")
>
>
>
> urls.py
>
> url(r'^password_change/$', views.password_change_dom, name=
> 'change_password')
>
> change_password.html
>
> {% extends "base_site_dom.html" %}
>
> {% block title %} - zmiana hasła {% endblock %}
>
> {% block content %}
>
> 
> Zmiana hasła na nowe.
> Wpisz nowe hasło 2 razy.
> 
> 
> 
> {% csrf_token %}
> {{ form.as_p }}
>   value="Wartoci początkowe">
> 
> 
> 
> 
> {% endblock %}
> {% block footer %}
> 
> Strona głóna
> 
> {% endblock %}
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e0eb0d5e-151b-492c-b9d8-07096e2a5dc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-07 Thread Dariusz Mysior
It work's! :)

Thank You!!

 now I have:

def password_change_dom(request):
if request.method == 'POST':
form = FormularzPasswordChange(request.POST)
if form.is_valid():
request.user.set_password(form.cleaned_data['password2'])
request.user.save()
template = loader.get_template(
"registration/change_password.html")
variables = RequestContext(request,{'user':request.user})
output = template.render(variables)
return HttpResponseRedirect("/")
else:
form = FormularzPasswordChange()
return render(request, 'registration/change_password.html', 
{'form': form})



W dniu wtorek, 7 października 2014 20:37:49 UTC+2 użytkownik Dariusz Mysior 
napisał:
>
> I have form to change password like below, and when I try to display it I 
> have an bug:
>
> ValueError at /password_change/
>   
>
> The view dom.views.password_change_dom didn't return an HttpResponse object.
>
>
>   
>
> 
>   
>   
> 
> 
>   
>   
> 
>
> 
>   
>   
> 
>
> 
>
>   Request Method:GETRequest URL:
> http://darmys.pythonanywhere.com/password_change/Django 
> Version:1.6.5Exception 
> Type:ValueErrorException Value:
>
> The view dom.views.password_change_dom didn't return an HttpResponse object.
>
>
> My forms.py is:
> class FormularzPasswordChange(forms.Form):
> password1 = forms.CharField(label="Hasło:",widget=forms.PasswordInput
> ())
> password2 = forms.CharField(label="Powtórz hasło:",widget=forms.
> PasswordInput())
>
> def clean_password2(self):
> password1 = self.cleaned_data['password1']
> password2 = self.cleaned_data['password2']
> if password1 == password2:
> return password2
> else:
> raise forms.ValidationError("Hasła się różnią")
>
>
>
> urls.py
>
> url(r'^password_change/$', views.password_change_dom, name=
> 'change_password')
>
> change_password.html
>
> {% extends "base_site_dom.html" %}
>
> {% block title %} - zmiana hasła {% endblock %}
>
> {% block content %}
>
> 
> Zmiana hasła na nowe.
> Wpisz nowe hasło 2 razy.
> 
> 
> 
> {% csrf_token %}
> {{ form.as_p }}
>   value="Wartoci początkowe">
> 
> 
> 
> 
> {% endblock %}
> {% block footer %}
> 
> Strona głóna
> 
> {% endblock %}
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/596fb0ed-e644-4911-afdb-9f42a9061e47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-07 Thread Collin Anderson
are they already logged in? use request.user.set_password() and 
request.user.save()

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8b5c498c-03f7-446f-80b0-1483bd0a6b1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-07 Thread Dariusz Mysior
It was like You said, now I see form and when I write password and submit I 
have 

KeyError at /password_change/
  

'username'


  


  
  


  
  



  
  



  
  




  
  




  
  Request Method:POSTRequest URL:http:
//darmys.pythonanywhere.com/password_change/Django Version:1.6.5Exception 
Type:KeyErrorException Value:

'username'

Exception Location:/home/darmys/dom/dom/views.py in password_change_dom, 
line 55



W dniu wtorek, 7 października 2014 21:21:16 UTC+2 użytkownik Collin 
Anderson napisał:
>
> also, I highly recommend the render() shortcut:
>
> def password_change_dom(request):
> if request.method == 'POST':
> form = FormularzPasswordChange(request.POST)
> if form.is_valid():
> user = authenticate(username=form.cleaned_data['username'])
> user.set_password(form.cleaned_data['password2'])
> user.save()
> login(request, user)
> return HttpResponseRedirect("/")
> else:
> form = FormularzPasswordChange()
> return render(request, 'registration/change_password.html', {'form': 
> form})
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a5e519f-61f2-49c3-83e8-fdc2a3c663dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-07 Thread Collin Anderson
also, I highly recommend the render() shortcut:

def password_change_dom(request):
if request.method == 'POST':
form = FormularzPasswordChange(request.POST)
if form.is_valid():
user = authenticate(username=form.cleaned_data['username'])
user.set_password(form.cleaned_data['password2'])
user.save()
login(request, user)
return HttpResponseRedirect("/")
else:
form = FormularzPasswordChange()
return render(request, 'registration/change_password.html', {'form': 
form})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/034d9180-b8c3-4fd1-8d37-9c0cf83c5280%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-07 Thread Collin Anderson
unindent the last bit:
 

> if request.method == 'POST':
> form = FormularzPasswordChange(request.POST)
> if form.is_valid():
> user = authenticate(username=form.cleaned_data['username'
> ])
>  #user = User.objects.get(username='username')
> user.set_password(form.cleaned_data['password2']),
> user.save()
> login(request,user)
> template = loader.get_template(
> "registration/change_password.html")
> variables = RequestContext(request,{'user':user})
> output = template.render(variables)
> return HttpResponseRedirect("/")
> else:
> form = FormularzPasswordChange()
> template = loader.get_template('registration/change_password.html'
> )
> variables = RequestContext(request,{'form':form})
> output = template.render(variables)
> return HttpResponse(output)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1ba3687d-286f-4c58-a3c2-fe2eb4fc2d8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-07 Thread Dariusz Mysior
It's :

ef password_change_dom(request):
if request.method == 'POST':
form = FormularzPasswordChange(request.POST)
if form.is_valid():
user = authenticate(username=form.cleaned_data['username'])
 #user = User.objects.get(username='username')
user.set_password(form.cleaned_data['password2']),
user.save()
login(request,user)
template = loader.get_template(
"registration/change_password.html")
variables = RequestContext(request,{'user':user})
output = template.render(variables)
return HttpResponseRedirect("/")
else:
form = FormularzPasswordChange()
template = loader.get_template(
'registration/change_password.html')
variables = RequestContext(request,{'form':form})
output = template.render(variables)
return HttpResponse(output)



W dniu wtorek, 7 października 2014 21:07:35 UTC+2 użytkownik Collin 
Anderson napisał:
>
> What does your password_change_dom view look like?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/12b78cb0-7c22-41bf-97ef-eac2bbf82fd6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: View didn't return an HttpResponse object

2014-10-07 Thread Collin Anderson
What does your password_change_dom view look like?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9648a050-dc2e-4339-89c3-980c3fc002fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


View didn't return an HttpResponse object

2014-10-07 Thread Dariusz Mysior
I have form to change password like below, and when I try to display it I 
have an bug:

ValueError at /password_change/
  

The view dom.views.password_change_dom didn't return an HttpResponse object.


  


  
  


  
  



  
  



   
  Request Method:GETRequest URL:
http://darmys.pythonanywhere.com/password_change/Django Version:1.6.5Exception 
Type:ValueErrorException Value:

The view dom.views.password_change_dom didn't return an HttpResponse object.


My forms.py is:
class FormularzPasswordChange(forms.Form):
password1 = forms.CharField(label="Hasło:",widget=forms.PasswordInput())
password2 = forms.CharField(label="Powtórz hasło:",widget=forms.
PasswordInput())

def clean_password2(self):
password1 = self.cleaned_data['password1']
password2 = self.cleaned_data['password2']
if password1 == password2:
return password2
else:
raise forms.ValidationError("Hasła się różnią")



urls.py

url(r'^password_change/$', views.password_change_dom, name='change_password'
)

change_password.html

{% extends "base_site_dom.html" %}

{% block title %} - zmiana hasła {% endblock %}

{% block content %}


Zmiana hasła na nowe.
Wpisz nowe hasło 2 razy.



{% csrf_token %}
{{ form.as_p }}
 




{% endblock %}
{% block footer %}

Strona głóna

{% endblock %}


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5535160a-444c-4ab9-a3bf-1898bf76f188%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: The view didn't return an HttpResponse object.

2012-10-01 Thread Satinderpal Singh
On Mon, Oct 1, 2012 at 4:58 PM, Babatunde Akinyanmi
<tundeba...@gmail.com> wrote:
> Oooops. I see the question has already been answered. My phone didn't
> get the update on time.
No worries, Thanks anyways

> On 10/1/12, Babatunde Akinyanmi <tundeba...@gmail.com> wrote:
>> Its possible that when you refresh the form and the POST request gets
>> submitted, the form doesn't pass the form.is_valid() if conditional.
>> In your code, you didn't make any provision for when the form fails
>> the is_valid() test and from your code, execution stops once
>> is_valid() returns False so I **guess** that's where the problem lies.
>>
>> Try re-rendering the submitted form if is_valid is False or doing a
>> redirect.
>>
>> On 10/1/12, Satinderpal Singh <satinder.goray...@gmail.com> wrote:
>>> I made a model form and a view which accepts input as a form and
>>> display it in the html format. As when i refresh the html page or try
>>> to fill another entry in the form, it gives the following error:
>>>
>>> The view Automation.report.views.chemical_analysis didn't return an
>>> HttpResponse object.
>>>
>>> Here is the views that creates this problem:
>>> def chemical_analysis(request):
>>>  if request.method=='POST':
>>>  form = chem_analysisForm(request.POST)
>>>  if form.is_valid():
>>>  cd = form.cleaned_data
>>>  form.save()
>>>  chem = chem_analysis.objects.all()
>>>  #return HttpResponseRedirect(chem)
>>>  return 
>>> render_to_response('report/chemical_analysis.html',
>>> {'chem': chem,},context_instance=RequestContext(request))
>>>
>>>  else:
>>>  form = chem_analysisForm()
>>>  return render_to_response('report/report.html', 
>>> {"form":form},
>>> context_instance=RequestContext(request))
>>>
>>> Any help regarding this will be highly appreciated.
>>>
>>> --
>>> Satinderpal Singh
>>> http://satindergoraya.blogspot.in/
>>> http://satindergoraya91.blogspot.in/
>>>
>>> --
>>> 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.
>>>
>>>
>>
>> --
>> Sent from my mobile device
>>
>
> --
> Sent from my mobile device
>
> --
> 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.
>



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



Re: The view didn't return an HttpResponse object.

2012-10-01 Thread Babatunde Akinyanmi
Oooops. I see the question has already been answered. My phone didn't
get the update on time.

On 10/1/12, Babatunde Akinyanmi <tundeba...@gmail.com> wrote:
> Its possible that when you refresh the form and the POST request gets
> submitted, the form doesn't pass the form.is_valid() if conditional.
> In your code, you didn't make any provision for when the form fails
> the is_valid() test and from your code, execution stops once
> is_valid() returns False so I **guess** that's where the problem lies.
>
> Try re-rendering the submitted form if is_valid is False or doing a
> redirect.
>
> On 10/1/12, Satinderpal Singh <satinder.goray...@gmail.com> wrote:
>> I made a model form and a view which accepts input as a form and
>> display it in the html format. As when i refresh the html page or try
>> to fill another entry in the form, it gives the following error:
>>
>> The view Automation.report.views.chemical_analysis didn't return an
>> HttpResponse object.
>>
>> Here is the views that creates this problem:
>> def chemical_analysis(request):
>>  if request.method=='POST':
>>  form = chem_analysisForm(request.POST)
>>  if form.is_valid():
>>  cd = form.cleaned_data
>>  form.save()
>>  chem = chem_analysis.objects.all()
>>  #return HttpResponseRedirect(chem)
>>  return 
>> render_to_response('report/chemical_analysis.html',
>> {'chem': chem,},context_instance=RequestContext(request))
>>  
>>  else:
>>  form = chem_analysisForm()
>>  return render_to_response('report/report.html', 
>> {"form":form},
>> context_instance=RequestContext(request))
>>  
>> Any help regarding this will be highly appreciated.
>>
>> --
>> Satinderpal Singh
>> http://satindergoraya.blogspot.in/
>> http://satindergoraya91.blogspot.in/
>>
>> --
>> 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.
>>
>>
>
> --
> Sent from my mobile device
>

-- 
Sent from my mobile device

-- 
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.



Re: The view didn't return an HttpResponse object.

2012-10-01 Thread Babatunde Akinyanmi
Its possible that when you refresh the form and the POST request gets
submitted, the form doesn't pass the form.is_valid() if conditional.
In your code, you didn't make any provision for when the form fails
the is_valid() test and from your code, execution stops once
is_valid() returns False so I **guess** that's where the problem lies.

Try re-rendering the submitted form if is_valid is False or doing a redirect.

On 10/1/12, Satinderpal Singh <satinder.goray...@gmail.com> wrote:
> I made a model form and a view which accepts input as a form and
> display it in the html format. As when i refresh the html page or try
> to fill another entry in the form, it gives the following error:
>
> The view Automation.report.views.chemical_analysis didn't return an
> HttpResponse object.
>
> Here is the views that creates this problem:
> def chemical_analysis(request):
>   if request.method=='POST':
>   form = chem_analysisForm(request.POST)
>   if form.is_valid():
>   cd = form.cleaned_data
>   form.save()
>   chem = chem_analysis.objects.all()
>   #return HttpResponseRedirect(chem)
>   return 
> render_to_response('report/chemical_analysis.html',
> {'chem': chem,},context_instance=RequestContext(request))
>   
>   else:
>   form = chem_analysisForm()
>   return render_to_response('report/report.html', 
> {"form":form},
> context_instance=RequestContext(request))
>   
> Any help regarding this will be highly appreciated.
>
> --
> Satinderpal Singh
> http://satindergoraya.blogspot.in/
> http://satindergoraya91.blogspot.in/
>
> --
> 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.
>
>

-- 
Sent from my mobile device

-- 
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.



Re: The view didn't return an HttpResponse object.

2012-10-01 Thread Tom Evans
On Mon, Oct 1, 2012 at 12:11 PM, Satinderpal Singh
<satinder.goray...@gmail.com> wrote:
> On Mon, Oct 1, 2012 at 4:27 PM, Tom Evans <tevans...@googlemail.com> wrote:
>> On Mon, Oct 1, 2012 at 11:36 AM, Satinderpal Singh
>> <satinder.goray...@gmail.com> wrote:
> I add the following to my code,
>>> I made a model form and a view which accepts input as a form and
>>> display it in the html format. As when i refresh the html page or try
>>> to fill another entry in the form, it gives the following error:
>>>
>>> The view Automation.report.views.chemical_analysis didn't return an
>>> HttpResponse object.
>>>
>>> Here is the views that creates this problem:
>>> def chemical_analysis(request):
>>> if request.method=='POST':
>>> form = chem_analysisForm(request.POST)
>>> if form.is_valid():
>>> cd = form.cleaned_data
>>> form.save()
>>> chem = chem_analysis.objects.all()
>>> #return HttpResponseRedirect(chem)
>>> return 
>>> render_to_response('report/chemical_analysis.html',
>>> {'chem': chem,},context_instance=RequestContext(request))
> else:
> return HttpResponse("There was an error with 
> your
> submission. Please try again.")
>>>
>>> else:
>>> form = chem_analysisForm()
>>> return render_to_response('report/report.html', 
>>> {"form":form},
>>> context_instance=RequestContext(request))
>>>
>>> Any help regarding this will be highly appreciated.
>>>
>>
>> If the request method is POST, but the form is not valid, then no
>> response is returned. You must return a response from every code path.
> Thanks, it works and now gives the error message, can you please tell
> me that why the input values are not saved in the database and it
> gives only the error message. Point me where i am wrong.
>

The form is not valid; check the data you are submitting and the form
definition to see why. The invalid form object itself will specify why
it is invalid, see the docs:

https://docs.djangoproject.com/en/1.4/topics/forms/#using-a-form-in-a-view
https://docs.djangoproject.com/en/1.4/ref/forms/api/#using-forms-to-validate-data

Cheers

Tom

-- 
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.



Re: The view didn't return an HttpResponse object.

2012-10-01 Thread Satinderpal Singh
On Mon, Oct 1, 2012 at 4:27 PM, Tom Evans <tevans...@googlemail.com> wrote:
> On Mon, Oct 1, 2012 at 11:36 AM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:
I add the following to my code,
>> I made a model form and a view which accepts input as a form and
>> display it in the html format. As when i refresh the html page or try
>> to fill another entry in the form, it gives the following error:
>>
>> The view Automation.report.views.chemical_analysis didn't return an
>> HttpResponse object.
>>
>> Here is the views that creates this problem:
>> def chemical_analysis(request):
>> if request.method=='POST':
>> form = chem_analysisForm(request.POST)
>> if form.is_valid():
>> cd = form.cleaned_data
>> form.save()
>> chem = chem_analysis.objects.all()
>> #return HttpResponseRedirect(chem)
>> return 
>> render_to_response('report/chemical_analysis.html',
>> {'chem': chem,},context_instance=RequestContext(request))
else:
return HttpResponse("There was an error with 
your
submission. Please try again.")
>>
>> else:
>> form = chem_analysisForm()
>> return render_to_response('report/report.html', 
>> {"form":form},
>> context_instance=RequestContext(request))
>>
>> Any help regarding this will be highly appreciated.
>>
>
> If the request method is POST, but the form is not valid, then no
> response is returned. You must return a response from every code path.
Thanks, it works and now gives the error message, can you please tell
me that why the input values are not saved in the database and it
gives only the error message. Point me where i am wrong.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



Re: The view didn't return an HttpResponse object.

2012-10-01 Thread Tom Evans
On Mon, Oct 1, 2012 at 11:36 AM, Satinderpal Singh
<satinder.goray...@gmail.com> wrote:
> I made a model form and a view which accepts input as a form and
> display it in the html format. As when i refresh the html page or try
> to fill another entry in the form, it gives the following error:
>
> The view Automation.report.views.chemical_analysis didn't return an
> HttpResponse object.
>
> Here is the views that creates this problem:
> def chemical_analysis(request):
> if request.method=='POST':
> form = chem_analysisForm(request.POST)
> if form.is_valid():
> cd = form.cleaned_data
> form.save()
> chem = chem_analysis.objects.all()
> #return HttpResponseRedirect(chem)
> return 
> render_to_response('report/chemical_analysis.html',
> {'chem': chem,},context_instance=RequestContext(request))
>
> else:
> form = chem_analysisForm()
> return render_to_response('report/report.html', 
> {"form":form},
> context_instance=RequestContext(request))
>
> Any help regarding this will be highly appreciated.
>

If the request method is POST, but the form is not valid, then no
response is returned. You must return a response from every code path.

Cheers

Tom

-- 
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.



The view didn't return an HttpResponse object.

2012-10-01 Thread Satinderpal Singh
I made a model form and a view which accepts input as a form and
display it in the html format. As when i refresh the html page or try
to fill another entry in the form, it gives the following error:

The view Automation.report.views.chemical_analysis didn't return an
HttpResponse object.

Here is the views that creates this problem:
def chemical_analysis(request):
if request.method=='POST':
form = chem_analysisForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
form.save()
chem = chem_analysis.objects.all()
#return HttpResponseRedirect(chem)
return 
render_to_response('report/chemical_analysis.html',
{'chem': chem,},context_instance=RequestContext(request))

else:
form = chem_analysisForm()
return render_to_response('report/report.html', 
{"form":form},
context_instance=RequestContext(request))

Any help regarding this will be highly appreciated.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread rick girdhar
after entering number in the template page .am getting the error,that is:

NoReverseMatch at /record_system/studentid/

Reverse for 'record_system.views.search' with arguments '(None,)' and
keyword arguments '{}' not found.



and this is my new updated view..


def search(request , rollno):
results =  Add_record.objects.filter(Student_ID = rollno)
return render_to_response('add_record/search.html', locals(),
context_instance=RequestContext(request))


def studentid(request):
if request.method == 'POST':
form = Student_loginForm(request.POST)
rollno = request.POST.get('rollno')
if form.is_valid():
cd = form.cleaned_data
rollno = cd['rollno']
return 
HttpResponseRedirect(reverse('record_system.views.search' ,
args=(rollno,)))
else:
form = Student_loginForm()
return render_to_response('add_record/studentid.html',
context_instance=RequestContext(request))

*
please help i can't able to find the solution as am new bie to the django...*
*thank you..*



On Fri, Jul 6, 2012 at 4:13 PM, manish girdhar wrote:

> hmmm i can find my solution after inserting this line
>
> rollno = request.POST.get('rollno')
>
> and this was the coding part of my application ,but can you please tell me
> that why my *" if form.is_valid():* "  is not working..what's wrong in
> this??
>
>
> On Fri, Jul 6, 2012 at 4:06 PM, manish girdhar 
> wrote:
>
>> hm  finally got it.thanks for the quick reply friend..thanks
>> alot.
>>
>>
>> On Fri, Jul 6, 2012 at 4:00 PM, Jani Tiainen  wrote:
>>
>>> 6.7.2012 13:18, manish girdhar kirjoitti:
>>>
>>>  so sorry friend..am new to the django and am unable to catch your
 point...can you please describe this with example or with my code..thank
 you..

>>>
>>> [Snip snip with binary scissors]
>>>
>>> Problem is that there is two problem points:
>>>
>>> Your view doesn't have "default path" so
>>> IF request.method is POST and IF form.is_valid is FALSE your code
>>> doesn't return anything.
>>>
>>> This means that your view will return something only if request.method
>>> is not POST (return render_to_response(...) is called) or if request.method
>>> is POST and form.is_valid() is true (return HttpResponseRedirect(..) is
>>> called)
>>>
>>> Simplest way to fix it is to indent last "return render_to_response..."
>>> one level outer (same level as if request.method == 'POST' and last else)
>>> making it to be executed if request.method is not POST or if
>>> form.is_valid() is false.
>>>
>>> In short form:
>>>
>>>
>>> def studentid(request):
>>> if request.method == 'POST'
>>> form = Student_loginForm(request.**POST)
>>> if form.is_valid():
>>> return HttpResponseRedirect(...)
>>> else:
>>> form = Student_loginForm()
>>> return render_to_response('add_**record/studentid.html', ...)
>>>
>>>
>>>
>>> --
>>> Jani Tiainen
>>>
>>> - Well planned is half done and a half done has been sufficient before...
>>>
>>>
>>> --
>>> 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
>>> .
>>>
>>>
>>
>

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread manish girdhar
hmmm i can find my solution after inserting this line

rollno = request.POST.get('rollno')

and this was the coding part of my application ,but can you please tell me
that why my *" if form.is_valid():* "  is not working..what's wrong in
this??

On Fri, Jul 6, 2012 at 4:06 PM, manish girdhar wrote:

> hm  finally got it.thanks for the quick reply friend..thanks
> alot.
>
>
> On Fri, Jul 6, 2012 at 4:00 PM, Jani Tiainen  wrote:
>
>> 6.7.2012 13:18, manish girdhar kirjoitti:
>>
>>  so sorry friend..am new to the django and am unable to catch your
>>> point...can you please describe this with example or with my code..thank
>>> you..
>>>
>>
>> [Snip snip with binary scissors]
>>
>> Problem is that there is two problem points:
>>
>> Your view doesn't have "default path" so
>> IF request.method is POST and IF form.is_valid is FALSE your code doesn't
>> return anything.
>>
>> This means that your view will return something only if request.method is
>> not POST (return render_to_response(...) is called) or if request.method is
>> POST and form.is_valid() is true (return HttpResponseRedirect(..) is called)
>>
>> Simplest way to fix it is to indent last "return render_to_response..."
>> one level outer (same level as if request.method == 'POST' and last else)
>> making it to be executed if request.method is not POST or if
>> form.is_valid() is false.
>>
>> In short form:
>>
>>
>> def studentid(request):
>> if request.method == 'POST'
>> form = Student_loginForm(request.**POST)
>> if form.is_valid():
>> return HttpResponseRedirect(...)
>> else:
>> form = Student_loginForm()
>> return render_to_response('add_**record/studentid.html', ...)
>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done and a half done has been sufficient before...
>>
>>
>> --
>> 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
>> .
>>
>>
>

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread manish girdhar
hm  finally got it.thanks for the quick reply friend..thanks
alot.

On Fri, Jul 6, 2012 at 4:00 PM, Jani Tiainen  wrote:

> 6.7.2012 13:18, manish girdhar kirjoitti:
>
>  so sorry friend..am new to the django and am unable to catch your
>> point...can you please describe this with example or with my code..thank
>> you..
>>
>
> [Snip snip with binary scissors]
>
> Problem is that there is two problem points:
>
> Your view doesn't have "default path" so
> IF request.method is POST and IF form.is_valid is FALSE your code doesn't
> return anything.
>
> This means that your view will return something only if request.method is
> not POST (return render_to_response(...) is called) or if request.method is
> POST and form.is_valid() is true (return HttpResponseRedirect(..) is called)
>
> Simplest way to fix it is to indent last "return render_to_response..."
> one level outer (same level as if request.method == 'POST' and last else)
> making it to be executed if request.method is not POST or if
> form.is_valid() is false.
>
> In short form:
>
>
> def studentid(request):
> if request.method == 'POST'
> form = Student_loginForm(request.**POST)
> if form.is_valid():
> return HttpResponseRedirect(...)
> else:
> form = Student_loginForm()
> return render_to_response('add_**record/studentid.html', ...)
>
>
>
> --
> Jani Tiainen
>
> - Well planned is half done and a half done has been sufficient before...
>
>
> --
> 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
> .
>
>

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread Jani Tiainen

6.7.2012 13:18, manish girdhar kirjoitti:

so sorry friend..am new to the django and am unable to catch your
point...can you please describe this with example or with my code..thank
you..


[Snip snip with binary scissors]

Problem is that there is two problem points:

Your view doesn't have "default path" so
IF request.method is POST and IF form.is_valid is FALSE your code 
doesn't return anything.


This means that your view will return something only if request.method 
is not POST (return render_to_response(...) is called) or if 
request.method is POST and form.is_valid() is true (return 
HttpResponseRedirect(..) is called)


Simplest way to fix it is to indent last "return render_to_response..." 
one level outer (same level as if request.method == 'POST' and last 
else) making it to be executed if request.method is not POST or if 
form.is_valid() is false.


In short form:

def studentid(request):
if request.method == 'POST'
form = Student_loginForm(request.POST)
if form.is_valid():
return HttpResponseRedirect(...)
else:
form = Student_loginForm()
return render_to_response('add_record/studentid.html', ...)


--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...


--
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread manish girdhar
so sorry friend..am new to the django and am unable to catch your
point...can you please describe this with example or with my code..thank
you..

On Fri, Jul 6, 2012 at 3:08 PM, Jani Tiainen  wrote:

> It doesn't ever work since you should rerender form with current data and
> errors if form.valid() returns false.
>
> Currently your logic doesn't return _nothing_ if form.valid() is false
>
>
> def studentid(request):
> if request.method == 'POST':
> form = Student_loginForm(request.**POST)
> if form.is_valid():
> cd = form.cleaned_data
> rollno = cd['rollno']
> return HttpResponseRedirect(reverse('**record_system.views.search'
> , args=(rollno)))
> # No else here, nothing is rendered!
>
> else:
> # This else is for if request.method == POST
>
> form = Student_loginForm()
> return render_to_response('add_**record/studentid.html',
> context_instance=**RequestContext(request))
>
>
> I suggest that you put last return one indent level to left so it will
> always render either errored form or in case method was not POST empty form.
>
> 6.7.2012 12:31, manish girdhar kirjoitti:
>
>> thanks for the concern firend but i already have an form.error in my
>> template...
>>
>>
>> *this is my template..
>>
>> *
>> 
>> 
>>  student id
>> 
>>
>> 
>>  {% if form.errors %}
>>  
>>  Please correct the error{{ form.errors|pluralize }} below.
>>  
>>  {% endif %}
>>   STUDENT RECORD SYSTEM
>>  
>>  
>>  {% csrf_token %}
>>
>>  Student Roll no:
>>   
>>   
>>  
>>
>>
>>
>> 
>> 
>>
>>
>> On Fri, Jul 6, 2012 at 2:49 PM, Jani Tiainen > > wrote:
>>
>> Print out form.errors it will contain dictionary about fields and
>> errors in particular field.
>>
>> You get the error because your form didn't validate in the first
>> place so either you have bad data, are missing required data or
>> something else in validation fails. form.errors will reveal that.
>>
>> 6.7.2012 12:16, manish girdhar kirjoitti:
>>
>> thank you for your concern friend,but i have an another view .in
>> that it
>> perfectly worksbut here am getting problem and i know
>>
>> *"if form.is_valid():"*   is getting falsewhat am looking for
>> is
>>
>> this, that why here am getting problem.
>> this thing perfectlly works in my adding two number view's
>> appication.
>>
>>
>> On Fri, Jul 6, 2012 at 2:35 PM, Karl Sutt > 
>> >> wrote:
>>
>>  There is no HttpResponse object returned if the form is
>> *not* valid.
>>
>>  You might want to return a template saying that the form
>> input was
>>  incorrect.
>>
>>  Tervitades/Regards
>>  Karl Sutt
>>
>>
>>
>>  On Fri, Jul 6, 2012 at 11:49 AM, manish girdhar
>>  > >
>> >
>> > wrote:
>>
>>  hii tom,
>>  yeah i have rectidy rollno = cd["rollno"] ,but again am
>> getting
>>  error didn't get an httpresponse object...
>>
>>  this is my view.
>>
>>
>>  def studentid(request):
>>   if request.method == 'POST':
>>   form = Student_loginForm(request.__**POST)
>>
>>   if form.is_valid():
>>   cd = form.cleaned_data
>>   rollno = cd['rollno']
>>   return
>>
>> HttpResponseRedirect(reverse('**__record_system.views.search' ,
>>
>>  args=(rollno)))
>>   else:
>>   form = Student_loginForm()
>>
>>   return
>> render_to_response('add___**record/studentid.html',
>>  context_instance=__**RequestContext(request))
>>
>>
>>
>>  the error is in*"if form.is_valid: "*..its getting
>> false and
>>
>>  ultimately the further process is not going on..
>>
>>  thanks in advance.
>>
>>
>>  On Thu, Jul 5, 2012 at 7:34 PM, Tom Evans
>>  > >
>> >
>> > wrote:
>>
>>  On Thu, Jul 5, 2012 at 8:38 AM, manish girdhar
>>  

Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread Jani Tiainen
It doesn't ever work since you should rerender form with current data 
and errors if form.valid() returns false.


Currently your logic doesn't return _nothing_ if form.valid() is false

def studentid(request):
if request.method == 'POST':
form = Student_loginForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
rollno = cd['rollno']
return 
HttpResponseRedirect(reverse('record_system.views.search' , args=(rollno)))

# No else here, nothing is rendered!

else:
# This else is for if request.method == POST
form = Student_loginForm()
return render_to_response('add_record/studentid.html', 
context_instance=RequestContext(request))



I suggest that you put last return one indent level to left so it will 
always render either errored form or in case method was not POST empty form.


6.7.2012 12:31, manish girdhar kirjoitti:

thanks for the concern firend but i already have an form.error in my
template...


*this is my template..
*


 student id



 {% if form.errors %}
 
 Please correct the error{{ form.errors|pluralize }} below.
 
 {% endif %}
  STUDENT RECORD SYSTEM
 
 
 {% csrf_token %}

 Student Roll no:
  
  
 







On Fri, Jul 6, 2012 at 2:49 PM, Jani Tiainen > wrote:

Print out form.errors it will contain dictionary about fields and
errors in particular field.

You get the error because your form didn't validate in the first
place so either you have bad data, are missing required data or
something else in validation fails. form.errors will reveal that.

6.7.2012 12:16, manish girdhar kirjoitti:

thank you for your concern friend,but i have an another view .in
that it
perfectly worksbut here am getting problem and i know

*"if form.is_valid():"*   is getting falsewhat am looking for is

this, that why here am getting problem.
this thing perfectlly works in my adding two number view's
appication.


On Fri, Jul 6, 2012 at 2:35 PM, Karl Sutt 
>> wrote:

 There is no HttpResponse object returned if the form is
*not* valid.

 You might want to return a template saying that the form
input was
 incorrect.

 Tervitades/Regards
 Karl Sutt



 On Fri, Jul 6, 2012 at 11:49 AM, manish girdhar
 
>> wrote:

 hii tom,
 yeah i have rectidy rollno = cd["rollno"] ,but again am
getting
 error didn't get an httpresponse object...

 this is my view.


 def studentid(request):
  if request.method == 'POST':
  form = Student_loginForm(request.__POST)
  if form.is_valid():
  cd = form.cleaned_data
  rollno = cd['rollno']
  return

HttpResponseRedirect(reverse('__record_system.views.search' ,
 args=(rollno)))
  else:
  form = Student_loginForm()

  return
render_to_response('add___record/studentid.html',
 context_instance=__RequestContext(request))


 the error is in*"if form.is_valid: "*..its getting
false and

 ultimately the further process is not going on..

 thanks in advance.


 On Thu, Jul 5, 2012 at 7:34 PM, Tom Evans
 
>> wrote:

 On Thu, Jul 5, 2012 at 8:38 AM, manish girdhar
 
 >> wrote:
  > yes it was indentation error and i rectified
that.thanks
 for the concern
  > friend..
  >

 I would have thought that it was you refering to
the undefined
 variable rollno here:

  cd = form.cleaned_data
  rollno = cd[rollno]
  rollno = request.POST.get(rollno)

 Should it not read:

  cd = 

Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread manish girdhar
thanks for the concern firend but i already have an form.error in my
template...


*this is my template..
*


student id



{% if form.errors %}

Please correct the error{{ form.errors|pluralize }} below.

{% endif %}
 STUDENT RECORD SYSTEM


{% csrf_token %}

Student Roll no:
 
 








On Fri, Jul 6, 2012 at 2:49 PM, Jani Tiainen  wrote:

> Print out form.errors it will contain dictionary about fields and errors
> in particular field.
>
> You get the error because your form didn't validate in the first place so
> either you have bad data, are missing required data or something else in
> validation fails. form.errors will reveal that.
>
> 6.7.2012 12:16, manish girdhar kirjoitti:
>
>> thank you for your concern friend,but i have an another view .in that it
>> perfectly worksbut here am getting problem and i know
>>
>> *"if form.is_valid():"*   is getting falsewhat am looking for is
>>
>> this, that why here am getting problem.
>> this thing perfectlly works in my adding two number view's appication.
>>
>>
>> On Fri, Jul 6, 2012 at 2:35 PM, Karl Sutt > > wrote:
>>
>> There is no HttpResponse object returned if the form is *not* valid.
>>
>> You might want to return a template saying that the form input was
>> incorrect.
>>
>> Tervitades/Regards
>> Karl Sutt
>>
>>
>>
>> On Fri, Jul 6, 2012 at 11:49 AM, manish girdhar
>> > >>
>> wrote:
>>
>> hii tom,
>> yeah i have rectidy rollno = cd["rollno"] ,but again am getting
>> error didn't get an httpresponse object...
>>
>> this is my view.
>>
>>
>> def studentid(request):
>>  if request.method == 'POST':
>>  form = Student_loginForm(request.**POST)
>>  if form.is_valid():
>>  cd = form.cleaned_data
>>  rollno = cd['rollno']
>>  return
>> HttpResponseRedirect(reverse('**record_system.views.search' ,
>> args=(rollno)))
>>  else:
>>  form = Student_loginForm()
>>
>>  return render_to_response('add_**record/studentid.html',
>> context_instance=**RequestContext(request))
>>
>>
>> the error is in*"if form.is_valid: "*..its getting false and
>>
>> ultimately the further process is not going on..
>>
>> thanks in advance.
>>
>>
>> On Thu, Jul 5, 2012 at 7:34 PM, Tom Evans
>> > >>
>> wrote:
>>
>> On Thu, Jul 5, 2012 at 8:38 AM, manish girdhar
>> > >>
>> wrote:
>>  > yes it was indentation error and i rectified that.thanks
>> for the concern
>>  > friend..
>>  >
>>
>> I would have thought that it was you refering to the undefined
>> variable rollno here:
>>
>>  cd = form.cleaned_data
>>  rollno = cd[rollno]
>>  rollno = request.POST.get(rollno)
>>
>> Should it not read:
>>
>>  cd = form.cleaned_data
>>  rollno = cd["rollno"]
>>  rollno = request.POST.get(rollno)
>>
>> Cheers
>>
>> Tom
>>
>> --
>> 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
>> .
>>
>>
>> --
>> 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
>> 
>> 

Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread Jani Tiainen
Print out form.errors it will contain dictionary about fields and errors 
in particular field.


You get the error because your form didn't validate in the first place 
so either you have bad data, are missing required data or something else 
in validation fails. form.errors will reveal that.


6.7.2012 12:16, manish girdhar kirjoitti:

thank you for your concern friend,but i have an another view .in that it
perfectly worksbut here am getting problem and i know

*"if form.is_valid():"*   is getting falsewhat am looking for is
this, that why here am getting problem.
this thing perfectlly works in my adding two number view's appication.


On Fri, Jul 6, 2012 at 2:35 PM, Karl Sutt > wrote:

There is no HttpResponse object returned if the form is *not* valid.
You might want to return a template saying that the form input was
incorrect.

Tervitades/Regards
Karl Sutt



On Fri, Jul 6, 2012 at 11:49 AM, manish girdhar
> wrote:

hii tom,
yeah i have rectidy rollno = cd["rollno"] ,but again am getting
error didn't get an httpresponse object...

this is my view.


def studentid(request):
 if request.method == 'POST':
 form = Student_loginForm(request.POST)
 if form.is_valid():
 cd = form.cleaned_data
 rollno = cd['rollno']
 return
HttpResponseRedirect(reverse('record_system.views.search' ,
args=(rollno)))
 else:
 form = Student_loginForm()

 return render_to_response('add_record/studentid.html',
context_instance=RequestContext(request))


the error is in*"if form.is_valid: "*..its getting false and
ultimately the further process is not going on..

thanks in advance.


On Thu, Jul 5, 2012 at 7:34 PM, Tom Evans
> wrote:

On Thu, Jul 5, 2012 at 8:38 AM, manish girdhar
> wrote:
 > yes it was indentation error and i rectified that.thanks
for the concern
 > friend..
 >

I would have thought that it was you refering to the undefined
variable rollno here:

 cd = form.cleaned_data
 rollno = cd[rollno]
 rollno = request.POST.get(rollno)

Should it not read:

 cd = form.cleaned_data
 rollno = cd["rollno"]
 rollno = request.POST.get(rollno)

Cheers

Tom

--
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.


--
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.


--
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.


--
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.


--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this 

Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread manish girdhar
thank you for your concern friend,but i have an another view .in that it
perfectly worksbut here am getting problem and i know

 *"if form.is_valid():"*   is getting falsewhat am looking for is this,
that why here am getting problem.
this thing perfectlly works in my adding two number view's appication.


On Fri, Jul 6, 2012 at 2:35 PM, Karl Sutt  wrote:

> There is no HttpResponse object returned if the form is *not* valid. You
> might want to return a template saying that the form input was incorrect.
>
> Tervitades/Regards
> Karl Sutt
>
>
>
> On Fri, Jul 6, 2012 at 11:49 AM, manish girdhar  > wrote:
>
>> hii tom,
>> yeah i have rectidy rollno = cd["rollno"] ,but again am getting error
>> didn't get an httpresponse object...
>>
>> this is my view.
>>
>>
>> def studentid(request):
>> if request.method == 'POST':
>> form = Student_loginForm(request.POST)
>> if form.is_valid():
>> cd = form.cleaned_data
>> rollno = cd['rollno']
>> return
>> HttpResponseRedirect(reverse('record_system.views.search' , args=(rollno)))
>> else:
>> form = Student_loginForm()
>>
>> return render_to_response('add_record/studentid.html',
>> context_instance=RequestContext(request))
>>
>>
>> the error is in* "if form.is_valid: "*..its getting false and ultimately
>> the further process is not going on..
>>
>> thanks in advance.
>>
>>
>> On Thu, Jul 5, 2012 at 7:34 PM, Tom Evans wrote:
>>
>>> On Thu, Jul 5, 2012 at 8:38 AM, manish girdhar
>>>  wrote:
>>> > yes it was indentation error and i rectified that.thanks for the
>>> concern
>>> > friend..
>>> >
>>>
>>> I would have thought that it was you refering to the undefined
>>> variable rollno here:
>>>
>>> cd = form.cleaned_data
>>> rollno = cd[rollno]
>>> rollno = request.POST.get(rollno)
>>>
>>> Should it not read:
>>>
>>> cd = form.cleaned_data
>>> rollno = cd["rollno"]
>>> rollno = request.POST.get(rollno)
>>>
>>> Cheers
>>>
>>> Tom
>>>
>>> --
>>> 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.
>>>
>>>
>>  --
>> 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.
>>
>
>  --
> 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.
>

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread Karl Sutt
There is no HttpResponse object returned if the form is *not* valid. You
might want to return a template saying that the form input was incorrect.

Tervitades/Regards
Karl Sutt


On Fri, Jul 6, 2012 at 11:49 AM, manish girdhar
wrote:

> hii tom,
> yeah i have rectidy rollno = cd["rollno"] ,but again am getting error
> didn't get an httpresponse object...
>
> this is my view.
>
>
> def studentid(request):
> if request.method == 'POST':
> form = Student_loginForm(request.POST)
> if form.is_valid():
> cd = form.cleaned_data
> rollno = cd['rollno']
> return
> HttpResponseRedirect(reverse('record_system.views.search' , args=(rollno)))
> else:
> form = Student_loginForm()
>
> return render_to_response('add_record/studentid.html',
> context_instance=RequestContext(request))
>
>
> the error is in* "if form.is_valid: "*..its getting false and ultimately
> the further process is not going on..
>
> thanks in advance.
>
>
> On Thu, Jul 5, 2012 at 7:34 PM, Tom Evans wrote:
>
>> On Thu, Jul 5, 2012 at 8:38 AM, manish girdhar
>>  wrote:
>> > yes it was indentation error and i rectified that.thanks for the concern
>> > friend..
>> >
>>
>> I would have thought that it was you refering to the undefined
>> variable rollno here:
>>
>> cd = form.cleaned_data
>> rollno = cd[rollno]
>> rollno = request.POST.get(rollno)
>>
>> Should it not read:
>>
>> cd = form.cleaned_data
>> rollno = cd["rollno"]
>> rollno = request.POST.get(rollno)
>>
>> Cheers
>>
>> Tom
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-06 Thread manish girdhar
hii tom,
yeah i have rectidy rollno = cd["rollno"] ,but again am getting error
didn't get an httpresponse object...

this is my view.

def studentid(request):
if request.method == 'POST':
form = Student_loginForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
rollno = cd['rollno']
return
HttpResponseRedirect(reverse('record_system.views.search' , args=(rollno)))
else:
form = Student_loginForm()
return render_to_response('add_record/studentid.html',
context_instance=RequestContext(request))


the error is in* "if form.is_valid: "*..its getting false and ultimately
the further process is not going on..

thanks in advance.

On Thu, Jul 5, 2012 at 7:34 PM, Tom Evans  wrote:

> On Thu, Jul 5, 2012 at 8:38 AM, manish girdhar
>  wrote:
> > yes it was indentation error and i rectified that.thanks for the concern
> > friend..
> >
>
> I would have thought that it was you refering to the undefined
> variable rollno here:
>
> cd = form.cleaned_data
> rollno = cd[rollno]
> rollno = request.POST.get(rollno)
>
> Should it not read:
>
> cd = form.cleaned_data
> rollno = cd["rollno"]
> rollno = request.POST.get(rollno)
>
> Cheers
>
> Tom
>
> --
> 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.
>
>

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 8:38 AM, manish girdhar
 wrote:
> yes it was indentation error and i rectified that.thanks for the concern
> friend..
>

I would have thought that it was you refering to the undefined
variable rollno here:

cd = form.cleaned_data
rollno = cd[rollno]
rollno = request.POST.get(rollno)

Should it not read:

cd = form.cleaned_data
rollno = cd["rollno"]
rollno = request.POST.get(rollno)

Cheers

Tom

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-05 Thread manish girdhar
yes it was indentation error and i rectified that.thanks for the concern
friend..

On Thu, Jul 5, 2012 at 12:40 PM, kenneth gonsalves
wrote:

> On Thu, 2012-07-05 at 12:29 +0530, manish girdhar wrote:
> > thanks for the help friend..after manipulate that thing i got an error
> > of*
> > *UnboundLocalError at /record_system/studentid/
> >
> > local variable 'rollno' referenced before assignment
> ah
> error in indentation - it is difficult to check this from your mail, so
> please paste the code in dpaste.com so that we can see what the exact
> indentation is.
> --
> regards
> Kenneth Gonsalves
>
> --
> 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.
>
>

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-05 Thread kenneth gonsalves
On Thu, 2012-07-05 at 12:29 +0530, manish girdhar wrote:
> thanks for the help friend..after manipulate that thing i got an error
> of*
> *UnboundLocalError at /record_system/studentid/
> 
> local variable 'rollno' referenced before assignment 

error in indentation - it is difficult to check this from your mail, so
please paste the code in dpaste.com so that we can see what the exact
indentation is.
-- 
regards
Kenneth Gonsalves

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-05 Thread manish girdhar
thank ...i rectify this error.

On Thu, Jul 5, 2012 at 12:29 PM, manish girdhar
<manishgirdha...@gmail.com>wrote:

> thanks for the help friend..after manipulate that thing i got an error of*
> *UnboundLocalError at /record_system/studentid/
>
> local variable 'rollno' referenced before assignment
>
> ...
>
> On Thu, Jul 5, 2012 at 11:52 AM, dizzydoc <htc.karanagar...@gmail.com>wrote:
>
>> The only condition where this view wont return an HTTPResponse is when
>> request.method == 'POST' is True and form.is_valid() is False.
>>
>> In this condition the outer if condtion would complete execution and exit
>> out since inner if condition is False and wont enter inner if condition.
>>
>> I think you should move out the return statement from the else loop.
>>
>>
>> On Thursday, July 5, 2012 10:43:29 AM UTC+5:30, rick wrote:
>>>
>>>
>>> i want to filter roll no from database,but when i enter the number
>>> ,browser gives *view didn't return an HttpResponse object* this is
>>> my view..
>>>
>>> def studentid(request):
>>> if request.method == 'POST':
>>> form = Student_loginForm(request.**POST)
>>> if form.is_valid():
>>> cd = form.cleaned_data
>>> rollno = cd[rollno]
>>> rollno = request.POST.get(rollno)
>>> results = Add_record.objects.filter(**Student_ID=rollno)
>>> return 
>>> HttpResponseRedirect(reverse('**record_system.views.search'
>>> ,args=(results,)))
>>> else:
>>> form = Student_loginForm
>>> return render_to_response('add_**record/studentid.html',
>>> context_instance=**RequestContext(request))
>>>
>>>
>>> please help...
>>> thanks in advance.
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/6178-1cjLacJ.
>>
>> 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.
>>
>
>

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-05 Thread manish girdhar
thanks for the help friend..after manipulate that thing i got an error of*
*UnboundLocalError at /record_system/studentid/

local variable 'rollno' referenced before assignment

...

On Thu, Jul 5, 2012 at 11:52 AM, dizzydoc <htc.karanagar...@gmail.com>wrote:

> The only condition where this view wont return an HTTPResponse is when
> request.method == 'POST' is True and form.is_valid() is False.
>
> In this condition the outer if condtion would complete execution and exit
> out since inner if condition is False and wont enter inner if condition.
>
> I think you should move out the return statement from the else loop.
>
>
> On Thursday, July 5, 2012 10:43:29 AM UTC+5:30, rick wrote:
>>
>>
>> i want to filter roll no from database,but when i enter the number
>> ,browser gives *view didn't return an HttpResponse object* this is
>> my view..
>>
>> def studentid(request):
>> if request.method == 'POST':
>> form = Student_loginForm(request.**POST)
>> if form.is_valid():
>> cd = form.cleaned_data
>> rollno = cd[rollno]
>> rollno = request.POST.get(rollno)
>> results = Add_record.objects.filter(**Student_ID=rollno)
>> return 
>> HttpResponseRedirect(reverse('**record_system.views.search'
>> ,args=(results,)))
>> else:
>> form = Student_loginForm
>> return render_to_response('add_**record/studentid.html',
>> context_instance=**RequestContext(request))
>>
>>
>> please help...
>> thanks in advance.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/6178-1cjLacJ.
>
> 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.
>

-- 
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.



Re: view didn't return an HttpResponse object....plz help

2012-07-05 Thread dizzydoc
The only condition where this view wont return an HTTPResponse is when 
request.method == 'POST' is True and form.is_valid() is False. 

In this condition the outer if condtion would complete execution and exit 
out since inner if condition is False and wont enter inner if condition.

I think you should move out the return statement from the else loop.

On Thursday, July 5, 2012 10:43:29 AM UTC+5:30, rick wrote:
>
>
> i want to filter roll no from database,but when i enter the number 
> ,browser gives *view didn't return an HttpResponse object* this is my 
> view..
>
> def studentid(request):
> if request.method == 'POST':
> form = Student_loginForm(request.POST)
> if form.is_valid():
> cd = form.cleaned_data
> rollno = cd[rollno]
> rollno = request.POST.get(rollno)
> results = Add_record.objects.filter(Student_ID=rollno)
> return 
> HttpResponseRedirect(reverse('record_system.views.search' ,args=(results,)))
> else:
> form = Student_loginForm
> return render_to_response('add_record/studentid.html', 
> context_instance=RequestContext(request))
>
>
> please help...
> thanks in advance.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/6178-1cjLacJ.
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.



view didn't return an HttpResponse object....plz help

2012-07-04 Thread rick

i want to filter roll no from database,but when i enter the number ,browser 
gives *view didn't return an HttpResponse object* this is my view..

def studentid(request):
if request.method == 'POST':
form = Student_loginForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
rollno = cd[rollno]
rollno = request.POST.get(rollno)
results = Add_record.objects.filter(Student_ID=rollno)
return 
HttpResponseRedirect(reverse('record_system.views.search' ,args=(results,)))
else:
form = Student_loginForm
return render_to_response('add_record/studentid.html', 
context_instance=RequestContext(request))


please help...
thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/8mDDh3cBWFkJ.
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.



Re: The view didn't return an HttpResponse object.

2008-12-16 Thread Malcolm Tredinnick


On Tue, 2008-12-16 at 23:23 -0800, oops wrote:
> def OrderPlacedView(request):
> form = OrderPlaceForm()
> try:
> print "try"
> print request.POST
> #brand = BrandName.objects.get(pk=request.POST['brand'])
> except:
> print"nothing"
> return render_to_response('inventory/orderprocess.html',
> {'form':form})
> 
> above is my view code when a try to call this view its give and error
> "The view  didn't return an HttpResponse object."
> 
> i have similar type of view which works fine whats the problem with
> this ..

Well, the error message is giving you a very big clue. When you see
that, look for all the ways that you are exiting that function. In this
case, what happens when no exception is raised?

At a guess, you have added the wrong indentation on the last line.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: The view didn't return an HttpResponse object.

2008-12-16 Thread Eric Abrahamsen


On Dec 17, 2008, at 3:23 PM, oops wrote:

>
> def OrderPlacedView(request):
>form = OrderPlaceForm()
>try:
>print "try"
>print request.POST
>#brand = BrandName.objects.get(pk=request.POST['brand'])
>except:
>print"nothing"
>return render_to_response('inventory/orderprocess.html',
> {'form':form})

This return statement is indented to be inside the except clause. If  
no exception is raised, the view doesn't return anything...

Yours,
Eric


>
>
> above is my view code when a try to call this view its give and error
> "The view  didn't return an HttpResponse object."
>
> i have similar type of view which works fine whats the problem with
> this ..
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



The view didn't return an HttpResponse object.

2008-12-16 Thread oops

def OrderPlacedView(request):
form = OrderPlaceForm()
try:
print "try"
print request.POST
#brand = BrandName.objects.get(pk=request.POST['brand'])
except:
print"nothing"
return render_to_response('inventory/orderprocess.html',
{'form':form})

above is my view code when a try to call this view its give and error
"The view  didn't return an HttpResponse object."

i have similar type of view which works fine whats the problem with
this ..
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: View didn't return an HttpResponse object?

2007-09-25 Thread Ryan K

Ok thank you! I've taken care of the superfluous code and thought it
was something silly I was missing. Thanks!

On Sep 25, 11:25 am, Tim Chase <[EMAIL PROTECTED]> wrote:
> > if not request.GET.get('avatarkey',''):
> > raise Http404
> > elif len(request.GET['avatarkey']) != 36:
> > raise Http404
>
> Just as a side-note, these two are a bit redundant.  I'd suggest
> either
>
>   if 'avatarkey' not in request.GET or
> len(request.GET['avatarkey'] != 36:
> raise Http404
>
> or even just
>
>   if len(request.GET.get('avatarkey', '') != 36:
> raise Http404
>
> because if the key is missing, your default's length is certainly
> not 36 either :)
>
> > else:
> > render_to_response('signup_s2.html',
> > {},RequestContext(request))
> > else:
> > raise Http404
>
> > Why does this code not work?
>
> Well, you're not doing a "return render_to_response".  If that's
> merely a code transcription omission, read on...otherwise, it
> would 'splain why it's not returning what you think it should be
> returning. :)
>
> I'm slightly confused why you're passing an empty dict() into
> your render_to_response() call.  Seems superfluous to me.
>
> Two other questions:
>
> Which version of Django are you using?
>
> What do you mean by "does...not work"?
>
> -tim


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: View didn't return an HttpResponse object?

2007-09-25 Thread Tim Chase

> if not request.GET.get('avatarkey',''):
> raise Http404
> elif len(request.GET['avatarkey']) != 36:
> raise Http404

Just as a side-note, these two are a bit redundant.  I'd suggest
either

  if 'avatarkey' not in request.GET or
len(request.GET['avatarkey'] != 36:
raise Http404

or even just

  if len(request.GET.get('avatarkey', '') != 36:
raise Http404

because if the key is missing, your default's length is certainly
not 36 either :)

> else:
> render_to_response('signup_s2.html',
> {},RequestContext(request))
> else:
> raise Http404
> 
> Why does this code not work?

Well, you're not doing a "return render_to_response".  If that's
merely a code transcription omission, read on...otherwise, it
would 'splain why it's not returning what you think it should be
returning. :)

I'm slightly confused why you're passing an empty dict() into
your render_to_response() call.  Seems superfluous to me.

Two other questions:

Which version of Django are you using?

What do you mean by "does...not work"?


-tim





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: View didn't return an HttpResponse object?

2007-09-25 Thread Chris Hoeppner

return render_to_response (...)

El mar, 25-09-2007 a las 10:14 +, Ryan K escribi�:
> 
> from django.http import HttpResponse, Http404
> from django.template import RequestContext
> from django.shortcuts import render_to_response
> 
> def verify_sl(request):
> if request.method == 'GET':
> if not request.GET.get('avatarkey',''):
> raise Http404
> elif len(request.GET['avatarkey']) != 36:
> raise Http404
> else:
> render_to_response('signup_s2.html',
> {},RequestContext(request))
> else:
> raise Http404
> 
> Why does this code not work?
> 
> 
> > 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



View didn't return an HttpResponse object?

2007-09-25 Thread Ryan K


from django.http import HttpResponse, Http404
from django.template import RequestContext
from django.shortcuts import render_to_response

def verify_sl(request):
if request.method == 'GET':
if not request.GET.get('avatarkey',''):
raise Http404
elif len(request.GET['avatarkey']) != 36:
raise Http404
else:
render_to_response('signup_s2.html',
{},RequestContext(request))
else:
raise Http404

Why does this code not work?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---