Give an example of a django view.
Answer / Varun Tiwari
Here's an example of a simple Django view that renders a basic HTML template:
views.py
```python
from django.shortcuts import render
def home(request):
return render(request, 'home.html')
```
urls.py
```python
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='home'),
]
| Is This Answer Correct ? | 0 Yes | 0 No |
What is a queryset in django?
What is render in django?
Is django a database?
Is django in the hateful eight?
What is token based authentication system ?
Does django use javascript?
How a request is process in Django ?
What are the two important parameters in signals?
What are views django?
Why django is used in python?
How do you count the occurrences of each item present in the list without explicitly mentioning them ?
What is middleware in django?