Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Handle a simple form submission and display submitted data.
# views.py
from django.shortcuts import render
def form_view(request):
submitted_data = None
if request.method == 'POST':
submitted_data = request.POST.get('data')
return render(request, 'form.html', {'data': submitted_data})
# form.html
"""
<form method='post'>
{% csrf_token %}
<input name='data' />
<button type='submit'>Submit</button>
</form>
{% if data %}
<p>You submitted: {{ data }}</p>
{% endif %}
"""Django is a high-level Python web framework that encourages rapid development, clean design, and pragmatic code. It includes built-in tools for ORM, authentication, routing, and templating.
Origin & Creator
Django was created by Adrian Holovaty and Simon Willison in 2005 at the Lawrence Journal-World newspaper.
Industrial Note
Django is used heavily in industries requiring rapid prototyping, content management systems, and scalable web applications, e.g., news, e-commerce, and SaaS.