diff options
-rw-r--r-- | core/views/uploads.py | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py index c81f4de..9451d1e 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -53,28 +53,40 @@ todo = """ """ -class FilesForm(forms.Form): # not a model-form, just a form-form +class DrawingsFilesForm(forms.Form): # not a model-form, just a form-form uploadfiles = forms.FileField() - who_are_you = forms.CharField( + who_are_you = forms.CharField( # when this does not commit to git, this is not used. widget=forms.TextInput( attrs={"size": 100, "placeholder": "You are editing this page, who are you ? e.g. 'Wookey' or 'Animal <mta@gasthof.expo>'", "style": "vertical-align: text-top;"} ) ) -class FilesRenameForm(forms.Form): # not a model-form, just a form-form + +class WalletFilesForm(forms.Form): # not a model-form, just a form-form + """Used only for uploading to expofiles/surveyscans/<year>/<wallet> + which is not a git repo so we do not need an "editor" to assign blame to + """ uploadfiles = forms.FileField() - renameto = forms.CharField(strip=True, required=False) + -class TextForm(forms.Form): # not a model-form, just a form-form +class PhotographerForm(forms.Form): # not a model-form, just a form-form photographer = forms.CharField(strip=True) -class TextProspectorForm(forms.Form): # not a model-form, just a form-form +class GPXuploadForm(forms.Form): # not a model-form, just a form-form prospector = forms.CharField(strip=True) +class FilesRenameForm(forms.Form): # not a model-form, just a form-form + """Used only for renaming photos in /expofiles/photos/ + which is not a git repo + """ + uploadfiles = forms.FileField() + renameto = forms.CharField(strip=True, required=False) + class ExpofileRenameForm(forms.Form): # not a model-form, just a form-form renameto = forms.CharField(strip=True, required=False) class ExpotextfileForm(forms.Form): # not a model-form, just a form-form + """Editing .txt files on /expoweb/ which is in a git repo""" text = forms.CharField(strip=True, required=False) who_are_you = forms.CharField( widget=forms.TextInput( @@ -391,12 +403,12 @@ def photoupload(request, folder=None): urldir = f"/photoupload/{year}" form = FilesRenameForm() - formd = TextForm() + formd = PhotographerForm() if request.method == "POST": if "photographer" in request.POST: # then we are creating a new folder - formd = TextForm(request.POST) + formd = PhotographerForm(request.POST) if formd.is_valid(): newphotographer = sanitize_name(request.POST["photographer"]) try: @@ -526,7 +538,7 @@ def gpxupload(request, folder=None): print(f"gpxupload() {folder=} {dirpath=} {urlfile=} {urldir=}") form = FilesRenameForm() - formd = TextProspectorForm() + formd = GPXuploadForm() print(f"gpxupload() {form=} {formd=} ") @@ -537,7 +549,7 @@ def gpxupload(request, folder=None): if "prospector" in request.POST: print(f"gpxupload() {request.POST=}\n {request.POST['prospector']=}") - formd = TextProspectorForm(request.POST) + formd = GPXuploadForm(request.POST) if formd.is_valid(): newprospector = sanitize_name(request.POST["prospector"]) print(f"gpxupload() {newprospector=}") @@ -711,10 +723,10 @@ def dwgupload(request, folder=None, gitdisable="no"): urldir = Path("/dwgupload/") / folder editor = get_cookie(request) - form = FilesForm() + form = DrawingsFilesForm() if request.method == "POST": - form = FilesForm(request.POST, request.FILES) + form = DrawingsFilesForm(request.POST, request.FILES) if form.is_valid(): # print(f'! - FORM dwgupload - POST valid: "{request.FILES["uploadfiles"]}" ') editor = form.cleaned_data["who_are_you"] |