Re: How can I pass input value to view function without forms

2021-05-27 Thread VREN
you mean request.method instead of request.post ?

On Thu, May 27, 2021 at 3:50 PM Bhanu prasad Ch  wrote:

> Hello Boris,
>   I was thinking of passing number from the input to view function
> *call_me_when_ten()*
> *index.html*
> ...
> 
> ...
>
> *views.py*
> def call_me_when_ten(request):
> if request.post == 'POST':
>   number = request.POST['numberid']
>   if number == 10:
>  print('hello world')
> return render(request,'index.html')
>
> I got this code from StackOverflow, but this isn't worked. Please, help me
> in solving out this problem.
>
> On Wednesday, May 26, 2021 at 5:02:04 AM UTC+5:30 Boris Pérez wrote:
>
>> Hi!!! usually HttpResponseRedirects work with reverse
>> function...something like this
>> def myview(request):
>> return HttpResponseRedirect(reverse('arch-summary', args=[1945]))
>> where 'arch-summary' is the path name and args=[1945] the args it
>> expects...
>> You need to modify also your urls.py to add tyhe name argument to your
>> url...
>> Greetings
>>
>> 2021-05-25 0:57 GMT-04:00, Bhanu prasad Ch :
>> > Hello everyone,
>> > Please help me out in understanding how to pass the redirected view
>> > with some arguments like userid to connect the URLs in Django
>> > [image: Screenshot_2.png][image: Screenshot_3.png]
>> > When I am doing this way it is redirecting to the self page that is
>> login.
>> > But I need the
>> > HttpResponseRedirect to redirect to the progress.
>> >
>> > --
>> > 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...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/django-users/2ebc28b3-0e99-4ace-9868-aad10564a172n%40googlegroups.com.
>>
>> >
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f17dd6c8-4228-46d4-b9f4-fb4059e5d536n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwzOPSKvSn2Jg1p%3DubhivRsyWif6k4iYtfksf-24%3DiNtFE-Ug%40mail.gmail.com.


Re: How can I pass input value to view function without forms

2021-05-27 Thread Antonis Christofides
You have a typo somehwere; in the HTML you have "numbered", whereas in the code 
you have "numberid".


Antonis Christofides
+30-6979924665 (mobile)

On 27/05/2021 13.20, Bhanu prasad Ch wrote:

Hello Boris,
      I was thinking of passing number from the input to view function 
/call_me_when_ten()/

/_index.html_/
...

...
/_
_/
/_views.py_/
def call_me_when_ten(request):
    if request.post == 'POST':
          number = request.POST['numberid']
          if number == 10:
                 print('hello world')
    return render(request,'index.html')

I got this code from StackOverflow, but this isn't worked. Please, help me in 
solving out this problem.


On Wednesday, May 26, 2021 at 5:02:04 AM UTC+5:30 Boris Pérez wrote:

Hi!!! usually HttpResponseRedirects work with reverse
function...something like this
def myview(request):
return HttpResponseRedirect(reverse('arch-summary', args=[1945]))
where 'arch-summary' is the path name and args=[1945] the args it expects...
You need to modify also your urls.py to add tyhe name argument to your 
url...
Greetings

2021-05-25 0:57 GMT-04:00, Bhanu prasad Ch :
> Hello everyone,
> Please help me out in understanding how to pass the redirected view
> with some arguments like userid to connect the URLs in Django
> [image: Screenshot_2.png][image: Screenshot_3.png]
> When I am doing this way it is redirecting to the self page that is login.
> But I need the
> HttpResponseRedirect to redirect to the progress.
>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
>

https://groups.google.com/d/msgid/django-users/2ebc28b3-0e99-4ace-9868-aad10564a172n%40googlegroups.com

.

>

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f17dd6c8-4228-46d4-b9f4-fb4059e5d536n%40googlegroups.com 
.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d4b4e6e-dfe1-7195-815c-85df71b94b59%40antonischristofides.com.


Re: How can I pass input value to view function without forms

2021-05-27 Thread Sharif Mehedi
How are you making the request?
   On Thursday, May 27, 2021, 4:20:55 PM GMT+6, Bhanu prasad Ch 
 wrote:  
 
 Hello Boris,      I was thinking of passing number from the input to view 
function call_me_when_ten()index.html..
views.pydef call_me_when_ten(request):    if request.post == 'POST':
          number = request.POST['numberid']          if number == 10:           
      print('hello world')    return render(request,'index.html')
I got this code from StackOverflow, but this isn't worked. Please, help me in 
solving out this problem.
On Wednesday, May 26, 2021 at 5:02:04 AM UTC+5:30 Boris Pérez wrote:

Hi!!! usually HttpResponseRedirects work with reverse
function...something like this
def myview(request):
 return HttpResponseRedirect(reverse('arch-summary', args=[1945]))
where 'arch-summary' is the path name and args=[1945] the args it expects...
You need to modify also your urls.py to add tyhe name argument to your url...
Greetings

2021-05-25 0:57 GMT-04:00, Bhanu prasad Ch :
> Hello everyone,
> Please help me out in understanding how to pass the redirected view
> with some arguments like userid to connect the URLs in Django
> [image: Screenshot_2.png][image: Screenshot_3.png]
> When I am doing this way it is redirecting to the self page that is login.
> But I need the
> HttpResponseRedirect to redirect to the progress.
>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2ebc28b3-0e99-4ace-9868-aad10564a172n%40googlegroups.com.
>



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f17dd6c8-4228-46d4-b9f4-fb4059e5d536n%40googlegroups.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1414205110.682508.1622113308712%40mail.yahoo.com.


Re: How can I pass input value to view function without forms

2021-05-27 Thread Bhanu prasad Ch
Hello Boris,
  I was thinking of passing number from the input to view function 
*call_me_when_ten()*
*index.html*
...

...

*views.py*
def call_me_when_ten(request):
if request.post == 'POST':
  number = request.POST['numberid']
  if number == 10:
 print('hello world')
return render(request,'index.html')

I got this code from StackOverflow, but this isn't worked. Please, help me 
in solving out this problem.

On Wednesday, May 26, 2021 at 5:02:04 AM UTC+5:30 Boris Pérez wrote:

> Hi!!! usually HttpResponseRedirects work with reverse
> function...something like this
> def myview(request):
> return HttpResponseRedirect(reverse('arch-summary', args=[1945]))
> where 'arch-summary' is the path name and args=[1945] the args it 
> expects...
> You need to modify also your urls.py to add tyhe name argument to your 
> url...
> Greetings
>
> 2021-05-25 0:57 GMT-04:00, Bhanu prasad Ch :
> > Hello everyone,
> > Please help me out in understanding how to pass the redirected view
> > with some arguments like userid to connect the URLs in Django
> > [image: Screenshot_2.png][image: Screenshot_3.png]
> > When I am doing this way it is redirecting to the self page that is 
> login.
> > But I need the
> > HttpResponseRedirect to redirect to the progress.
> >
> > --
> > 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...@googlegroups.com.
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/django-users/2ebc28b3-0e99-4ace-9868-aad10564a172n%40googlegroups.com
> .
> >
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f17dd6c8-4228-46d4-b9f4-fb4059e5d536n%40googlegroups.com.