Piki is a minimal wiki
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

forms.py 567B

1234567891011121314
  1. from typing import Any, Mapping
  2. from django import forms
  3. from django.forms.renderers import BaseRenderer
  4. from django.forms.utils import ErrorList
  5. class EditForm(forms.Form): # Note that it is not inheriting from forms.ModelForm
  6. page_txt = forms.CharField(max_length=20000, label="Page source text", widget=forms.Textarea(attrs={"rows": "20"}))
  7. def __init__(self, *args, **kwargs) -> None:
  8. page_data = kwargs.pop("page_data")
  9. super().__init__(*args, **kwargs)
  10. page_txt = self.fields['page_txt']
  11. page_txt.initial = page_data