use this to access the city_name field value;

form.cleaned_data[“city_name”]

Use to a print statement to see for yourself.

On Mon, 6 May 2019 at 1:42 PM, Mayur Bagul <mayur.bag...@gmail.com> wrote:

> Hello Community,
>
> I've been stuck to this problem from one week. I have read Django Doc. and
> i found little bit relevant to my problem.
>
> *Form.py*
>
>
> from django import forms
>
> class NameForm(forms.Form):
>     city_name = forms.CharField(label='city name', max_length=100)
>
>
>
> *Views.py*
>
>
>
> from django.http import HttpResponseRedirect
> from django.shortcuts import render
>
> from .forms import NameForm
>
> def get_name(request):
>
>     if request.method == 'POST':
>
>         form = NameForm(request.POST)
>
>      * # Here i wanted to extract value stored inside Text Box*  *How i
> can do that?*
>
>      *#i wanted to extract city entered by user and store into another
> variable how to do it?*
>
>      *# i wanted to use that variable to put it for filter *
>
>
>                    info = Data.objects.filter(city__exact=*'city'*)
>
>                    above line is for retrieving  record for entered city
> from database.
>
>
>        return render(request, 'name.html', {'info': info})
>
>     else:
>         form = NameForm()
>
>     return render(request, 'name.html', {'form': form})
>
>
>
>
> *Please help me with this guys !*
>
> *i really need help on this because im not getting syntax for this on any
> resource.*
>
> *Thanking you.*
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/666102fa-661e-4330-97f1-1414d7b08bce%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/666102fa-661e-4330-97f1-1414d7b08bce%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhdOCPV-ac2FEJJhtUvvK_rqYgZJ7qAt9zb-4qXyxpGMGPBxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to