FossilRepo
| 4ce269c… | ragelink | 1 | from django import forms |
| 4ce269c… | ragelink | 2 | |
| 4ce269c… | ragelink | 3 | from .models import Page |
| 4ce269c… | ragelink | 4 | |
| 4ce269c… | ragelink | 5 | tw = "w-full rounded-md border-gray-300 shadow-sm focus:border-brand focus:ring-brand sm:text-sm" |
| 4ce269c… | ragelink | 6 | |
| 4ce269c… | ragelink | 7 | |
| 4ce269c… | ragelink | 8 | class PageForm(forms.ModelForm): |
| 4ce269c… | ragelink | 9 | class Meta: |
| 4ce269c… | ragelink | 10 | model = Page |
| 4ce269c… | ragelink | 11 | fields = ["name", "content", "is_published"] |
| 4ce269c… | ragelink | 12 | widgets = { |
| 4ce269c… | ragelink | 13 | "name": forms.TextInput(attrs={"class": tw, "placeholder": "Page title"}), |
| 4ce269c… | ragelink | 14 | "content": forms.Textarea(attrs={"class": tw + " font-mono", "rows": 20, "placeholder": "Write in Markdown..."}), |
| 4ce269c… | ragelink | 15 | "is_published": forms.CheckboxInput(attrs={"class": "rounded border-gray-300 text-brand"}), |
| 4ce269c… | ragelink | 16 | } |