31 lines
939 B
Python
31 lines
939 B
Python
from __future__ import annotations
|
|
|
|
from django import forms
|
|
|
|
|
|
class ManualImportForm(forms.Form):
|
|
source_url = forms.URLField(
|
|
required=False,
|
|
label="Vacature-URL",
|
|
max_length=1000,
|
|
widget=forms.URLInput(attrs={"autocomplete": "off"}),
|
|
)
|
|
pasted_text = forms.CharField(
|
|
required=False,
|
|
label="Tekst plakken",
|
|
widget=forms.Textarea(
|
|
attrs={
|
|
"rows": 6,
|
|
"placeholder": "Plak hier de vacaturetekst of relevante pagina-inhoud.",
|
|
}
|
|
),
|
|
)
|
|
|
|
def clean(self):
|
|
data = super().clean()
|
|
source_url = (data.get("source_url") or "").strip()
|
|
pasted_text = (data.get("pasted_text") or "").strip()
|
|
if not source_url and not pasted_text:
|
|
raise forms.ValidationError("Vul een URL of een tekstfragment in.")
|
|
return {"source_url": source_url, "pasted_text": pasted_text}
|