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