{% block css %}
td.top_field { width: 100%; }
-td.flags { text-align: right; }
td.tag_checkboxes { width: 1em; }
+td.dangerous, div.dangerous { text-align: right; }
+input[type=submit].dangerous { color: red; }
{% endblock %}
<tr>
<th>flags:</th>
-<td class="flags">
+<td class="dangerous">
{% for flag_name in flag_names %}
{{ flag_name }}: <input type="checkbox" name="flags" value="{{flag_name}}" {% if file.is_flag_set(flag_name) %}checked{% endif %}{% if not allow_edit %} disabled{% endif %}/><br />
{% endfor %}
</table>
{% if allow_edit %}
-<input type="submit" />
+<input type="submit" name="update" value="update" />
+<div class="dangerous">
+<input class="dangerous" type="submit" name="unlink" value="unlink (locally)" />
+</div>
</form>
{% endif %}
{% endblock %}
return # … this display filter might have suppressed set tags
with DbConn() as conn:
file = VideoFile.get_one(conn, digest)
+ if 'unlink' in postvars.as_dict:
+ file.unlink_locally()
file.set_flags({FILE_FLAGS[FlagName(name)]
for name in postvars.all_for('flags')})
file.tags = TagSet.from_str_list(postvars.all_for('tags'))
if self.is_flag_set(FlagName('delete')) and self.present:
print(f'SYNC: {self.rel_path} set "delete", '
'removing from filesystem.')
- self.full_path.unlink()
+ self.unlink_locally()
+
+ def unlink_locally(self) -> None:
+ """Remove actual file from local filesystem."""
+ self.full_path.unlink()
class QuotaLog(DbData):