You would use the data from request.POST or request.GET.
Here’s everything you need to know about views:
https://docs.djangoproject.com/en/2.2/topics/http/views/

Here’s an example:

def my_view(request):
               if request.POST:
                              field1 = request.POST.get(‘field1’)
                              field2 = request.POST.get(‘field2’)
                              model = MyModel.objects.create(field1=field1, 
field2=field2)
                              return redirect(model.get_absolute_url())
               return whatever

From: [email protected] [mailto:[email protected]] On 
Behalf Of Aayush Bhattarai
Sent: Friday, April 26, 2019 8:53 AM
To: Django users
Subject: How to Update Database

How can I update database. I am not using forms.py and I am using function 
based view. Can you how example and link for docs. Thanks for help.
--
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 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
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/41384b09-ed76-4485-9518-8dc10e26f2fa%40googlegroups.com<https://groups.google.com/d/msgid/django-users/41384b09-ed76-4485-9518-8dc10e26f2fa%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 [email protected].
To post to this group, send email to [email protected].
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/4f036748087c41598da4b7180f3aa231%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.

Reply via email to