Answer the question
In order to leave comments, you need to log in
How to correctly pass a dictionary from one method to another?
Hello, I want to know how should I pass a dictionary from one method to another in the View class
from django.contrib import messages
from django.core.mail import send_mail
from django.shortcuts import render
from django.views.generic import ListView, DetailView, View
from .models import *
from .forms import *
class HomeNews(View):
def get(self, request):
context = {
'Какой-то элемент': 'В context не один элемент, но не суть',
}
return render(request, 'news/index.html', context)
def post(self, request):
return render(request, 'news/index.html', context)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question