Piki is a minimal wiki
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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