Piki is a minimal wiki
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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