Repository: CTFd/CTFd

Issue:
Add time to export filename



Discussion:
Is there a real benefit or need for this? I also dont see a reference for %T on https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
# [Codecov](https://codecov.io/gh/CTFd/CTFd/pull/1949?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd) Report
> Merging [#1949](https://codecov.io/gh/CTFd/CTFd/pull/1949?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd) (2f34fee) into [master](https://codecov.io/gh/CTFd/CTFd/commit/327d28070204ae8333b78477aab6774a2cce9132?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd) (327d280) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/CTFd/CTFd/pull/1949/graphs/tree.svg?width=650&height=150&src=pr&token=IfPqkWkt9A&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd)](https://codecov.io/gh/CTFd/CTFd/pull/1949?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd)

```diff
@@           Coverage Diff           @@
##           master    #1949   +/-   ##
=======================================
  Coverage   89.62%   89.62%           
=======================================
  Files         136      136           
  Lines        7727     7727           
=======================================
  Hits         6925     6925           
  Misses        802      802           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/CTFd/CTFd/pull/1949?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/CTFd/CTFd/pull/1949?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd). Last update [327d280...2f34fee](https://codecov.io/gh/CTFd/CTFd/pull/1949?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CTFd).

`%T` same as `%H:%M:%S`.
This change can make it more convenient to export data within a day.

<img width="301" alt="image" src="https://user-images.githubusercontent.com/14134195/126026172-e3e0302c-ab5b-4157-96df-560f6d1efbf7.png">


Resolving patch:
diff --git a/CTFd/admin/__init__.py b/CTFd/admin/__init__.py
--- a/CTFd/admin/__init__.py
+++ b/CTFd/admin/__init__.py
@@ -110,7 +110,7 @@ def import_ctf():
 def export_ctf():
     backup = export_ctf_util()
     ctf_name = ctf_config.ctf_name()
-    day = datetime.datetime.now().strftime("%Y-%m-%d")
+    day = datetime.datetime.now().strftime("%Y-%m-%d_%T")
     full_name = u"{}.{}.zip".format(ctf_name, day)
     return send_file(
         backup, cache_timeout=-1, as_attachment=True, attachment_filename=full_name
diff --git a/manage.py b/manage.py
--- a/manage.py
+++ b/manage.py
@@ -61,7 +61,7 @@ def export_ctf(path=None):
                 shutil.copyfileobj(backup, target)
         else:
             name = ctf_name()
-            day = datetime.datetime.now().strftime("%Y-%m-%d")
+            day = datetime.datetime.now().strftime("%Y-%m-%d_%T")
             full_name = f"{name}.{day}.zip"
 
             with open(full_name, "wb") as target:


Test patch: