What do you want to save?
Add Code snippet
New code examples
-
Other 2022-02-28 18:55:05
django forms views.py
from django.http import HttpResponseRedirect from django.shortcuts import render from .forms import NameForm def get_name(request): # if this is a POST request we need to process the form data if request.method == 'POST': # create a form... Add solution -
Python 2021-11-16 14:04:22
in function how to get data from django form
from django.core.mail import send_mail if form.is_valid(): subject = form.cleaned_data['subject'] message = form.cleaned_data['message'] sender = form.cleaned_data['sender'] cc_myself = form.cleaned_data['cc_myself'] recipients = ['i... Add solution -
Python 2021-10-02 13:03:04
redirect a post request django
def redirected_view(request): # Some processing if needed ... # save post data to session & redirect request.session['_post_data'] = request.POST return HttpResponseRedirect('redirect_to_view') def redirect_to_view(request): o... Add solution -
Python 2021-10-02 08:32:05
django start python function when pressing button
index.html <form method="post"> {% csrf_token %} <button type="submit" name="run_script">Run script</button> </form> views.py if request.method == 'POST' and 'run_script' in request.POST: ... Add solution