forked from expo/troggle
filesize now shown
This commit is contained in:
parent
89c1c65340
commit
8d9b320d89
@ -34,7 +34,9 @@ todo = """
|
|||||||
|
|
||||||
- Enable folder creation in dwguploads or as a separate form
|
- Enable folder creation in dwguploads or as a separate form
|
||||||
|
|
||||||
- Enable file rename on expofiles, particularly in /surveyscans/ (aka wallets)
|
- Enable file rename on expofiles, not just for /surveyscans/ (aka wallets)
|
||||||
|
|
||||||
|
- Make file rename utility less ugly.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class FilesForm(forms.Form): # not a model-form, just a form-form
|
class FilesForm(forms.Form): # not a model-form, just a form-form
|
||||||
@ -69,7 +71,8 @@ def expofilerename(request, filepath):
|
|||||||
return render(request, "errors/generic.html", {"message": message})
|
return render(request, "errors/generic.html", {"message": message})
|
||||||
else:
|
else:
|
||||||
filename = Path(filepath).name
|
filename = Path(filepath).name
|
||||||
folder = Path(actualpath).parent
|
folder = actualpath.parent
|
||||||
|
filesize = f"{actualpath.stat().st_size:,}"
|
||||||
|
|
||||||
if not actualpath.is_relative_to(Path(settings.SCANS_ROOT)):
|
if not actualpath.is_relative_to(Path(settings.SCANS_ROOT)):
|
||||||
message = f'\n Can only do rename within wallets (expofiles/surveyscans/) currently, sorry. "{actualpath}" '
|
message = f'\n Can only do rename within wallets (expofiles/surveyscans/) currently, sorry. "{actualpath}" '
|
||||||
@ -101,6 +104,7 @@ def expofilerename(request, filepath):
|
|||||||
"form": form,
|
"form": form,
|
||||||
"filepath": filepath,
|
"filepath": filepath,
|
||||||
"filename": filename,
|
"filename": filename,
|
||||||
|
"filesize": filesize,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,9 +5,12 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h2>Rename "{{filename}}"</h2>
|
<h2>Rename "{{filename}}"</h2>
|
||||||
|
<a href="/expofiles/{{filepath|urlencode}}">
|
||||||
<figure class=onleft>
|
<figure class=onleft>
|
||||||
<img src="/expofiles/{{filepath|urlencode}}" width=150px>
|
<img src="/expofiles/{{filepath|urlencode}}" width=150px>
|
||||||
</figure>
|
<figcaption>filesize: {{filesize}} bytes
|
||||||
|
</figcaption>
|
||||||
|
</figure></a>
|
||||||
<div style = "max-width:95%; margin-left:8%; text-align: left; " >
|
<div style = "max-width:95%; margin-left:8%; text-align: left; " >
|
||||||
<form method ='post' >
|
<form method ='post' >
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
@ -17,7 +20,7 @@
|
|||||||
pattern="[A-Za-z][A-Za-z0-9_-\.]*"/>
|
pattern="[A-Za-z][A-Za-z0-9_-\.]*"/>
|
||||||
<label
|
<label
|
||||||
style="padding: 0.5em 25px; margin-left: 110px"
|
style="padding: 0.5em 25px; margin-left: 110px"
|
||||||
for="renameto">the new name for this file<br></label>
|
for="renameto">type in the new name for this file<br></label>
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
|
|
||||||
<button class="fancybutton2" style="padding: 0.5em 25px; margin-left: 110px" type = "submit" value = "Upload" >
|
<button class="fancybutton2" style="padding: 0.5em 25px; margin-left: 110px" type = "submit" value = "Upload" >
|
||||||
@ -26,7 +29,7 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<br /><br /><br />
|
<br /><br /><br />
|
||||||
Full urlencoded path for this file <a href="/expofiles/{{filepath|urlencode}}"><em>{{filepath|urlencode}}</em></a>
|
Full urlencoded path for this file in expofiles is <a href="/expofiles/{{filepath|urlencode}}"><em>{{filepath|urlencode}}</em></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user