I am trying to create a Django app. I want create function to pass some initial text to text area. I tried following:
Here is required part of views.py :
from django import forms
class createform(forms.Form):
def __init__(self, title, value):
self.newtitle = forms.CharField(max_length=30, label='Enter Title:', widget=forms.TextInput(attrs={'value': title}))
self.content = forms.CharField(widget=forms.Textarea(attrs={'value': value}), label='Enter the description:')
def create(request):
return render(request, "encyclopedia/create.html", {
"form": createform('this title','this content')
})
Here is my create.html file:
{% extends "encyclopedia/layout.html" %}
{% block title %}
Create New Page
{% endblock %}
{% block body %}
<form action="{% url 'create' %}" method="post" class="createnew">
{% csrf_token %}
{{ form }}
<input type="submit" value="Create New Page">
</form>
{% endblock %}
Here is url.py:
from django.urls import path
from . import views
urlpatterns = [
path("", views.index, name="index"),
path("wiki/<str:title>/", views.entries, name="entries"),
path("find/", views.find, name="find"),
path("create/", views.create, name="create")
]
But when I try to run this I get following error:

/create/view, where you userenderer__init__method properly? Is the method originally supposed to do anything else? What about the method signature, have you preserved the original method signature?class createformso that I can put some text initially in textarea. I saw some solutions where__init__was used to take arguments. I don't actually know much about it. Sorry to be dumb.