2024-10-05 16:22:40 +02:00
|
|
|
from typing import Any, Mapping
|
|
|
|
from django import forms
|
|
|
|
from django.forms.renderers import BaseRenderer
|
|
|
|
from django.forms.utils import ErrorList
|
|
|
|
|
2024-10-21 07:20:37 +02:00
|
|
|
from .models import PikiPage
|
2024-10-05 16:22:40 +02:00
|
|
|
|
|
|
|
|
2024-10-21 07:20:37 +02:00
|
|
|
class EditForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = PikiPage
|
|
|
|
fields = ["page_txt", "tags", "owner", "group"]
|
2024-10-18 20:47:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
class RenameForm(forms.Form): # Note that it is not inheriting from forms.ModelForm
|
|
|
|
page_name = forms.CharField(max_length=500, label="Change the page name:", required=True)
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs) -> None:
|
|
|
|
page_name = kwargs.pop("page_name")
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
self.fields['page_name'].initial = page_name
|