Piki is a minimal wiki
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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