Piki is a minimal wiki
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

forms.py 678B

123456789101112131415161718192021
  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. from .models import PikiPage
  6. class EditForm(forms.ModelForm):
  7. class Meta:
  8. model = PikiPage
  9. fields = ["page_txt", "tags", "owner", "group"]
  10. class RenameForm(forms.Form): # Note that it is not inheriting from forms.ModelForm
  11. page_name = forms.CharField(max_length=500, label="Change the page name:", required=True)
  12. def __init__(self, *args, **kwargs) -> None:
  13. page_name = kwargs.pop("page_name")
  14. super().__init__(*args, **kwargs)
  15. self.fields['page_name'].initial = page_name