django import csrf exemplt
# Step 1: Import the required module
from django.middleware.csrf import get_token
# Step 2: Get the CSRF token
csrf_token = get_token(request)
# Step 3: Pass the CSRF token to the template context
context = {'csrf_token': csrf_token}
# Step 4: Use the CSRF token in the template
<form method="post" action="{% url 'your_view_name' %}">
{% csrf_token %}
<!-- Other form fields go here -->
<input type="submit" value="Submit">
</form>