Piki is a minimal wiki
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

forms.py 744B

12345678910111213141516
  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. page_tags = forms.CharField(max_length=20000, label="Tags (words separated by spaces)", required=False)
  8. def __init__(self, *args, **kwargs) -> None:
  9. page_data = kwargs.pop("page_data")
  10. page_tags = kwargs.pop("page_tags")
  11. super().__init__(*args, **kwargs)
  12. self.fields['page_txt'].initial = page_data
  13. self.fields['page_tags'].initial = page_tags