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