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 863B

1234567891011121314151617181920212223242526
  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 = [
  10. "page_txt",
  11. "tags",
  12. "owner", "owner_perms_read", "owner_perms_write",
  13. "group", "group_perms_read", "group_perms_write",
  14. "other_perms_read", "other_perms_write",]
  15. class RenameForm(forms.Form): # Note that it is not inheriting from forms.ModelForm
  16. page_name = forms.CharField(max_length=500, label="Change the page name:", required=True)
  17. def __init__(self, *args, **kwargs) -> None:
  18. page_name = kwargs.pop("page_name")
  19. super().__init__(*args, **kwargs)
  20. self.fields['page_name'].initial = page_name