Jezzy Grey

Generation

class from descriptionSun, 19 Feb 2023

django framework. views file Create several classes that implement the task of tearing text in two fields entered by the user. These forms must be passed to the idnex html template

from django.shortcuts import render # Create your views here. from django.http import HttpResponse class ManageTextForm: texto = "" resultado = "" def __init__(self, texto_recibido): self.texto = texto_recibido self.resultado = self.texto.split() class IndexView(TemplateView): template_name = 'index.html' def get(self, request): form = ManageTextForm() return render(request, self.template_name, {'form':form}) def post(self, request): form = ManageTextForm(request.POST['text']) return render(request, self.template_name, {'form':form})

Questions about programming?Chat with your personal AI assistant