1. Home
  2. /
  3. Django
  4. /
  5. Redirect Example

Redirect Example - Django Typing CST Test

Loading…

Redirect Example — Django Code

Redirect users from one view to another.

# views.py
from django.shortcuts import redirect

def old_view(request):
	return redirect('new_view')

def new_view(request):
	return HttpResponse('This is the new view')

Django Language Guide

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.

Primary Use Cases

  • ▸Building dynamic web applications and websites
  • ▸Developing RESTful APIs with Django REST Framework
  • ▸Rapid prototyping of web projects
  • ▸CMS and admin dashboard applications
  • ▸E-commerce and SaaS applications

Notable Features

  • ▸Object-relational mapping (ORM) for database operations
  • ▸Built-in authentication and user management
  • ▸Automatic admin interface
  • ▸Template system for HTML generation
  • ▸URL routing and middleware support

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.

More Django Typing Exercises

Django Simple Counter AppDjango Form Submission ExampleDjango Template Rendering ExampleDjango URL Parameters ExampleDjango Model Form ExampleDjango List View ExampleDjango Session ExampleDjango Template Inheritance ExampleDjango Static Files Example

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher