source: OpenWorkouts-current/ow/migrations/3.py @ 8c2b094

current
Last change on this file since 8c2b094 was fcf0ef3, checked in by Borja Lopez <borja@…>, 5 years ago

(#77) Bulk workouts upload:

  • Added a new Folder-like object under the root object to store compressed files
  • Added a new Blob-like object to store those compressed files into the database
  • Added the needed view/template code to handle adding/uploading compressed files that may contain workout tracking files + a page to see them per-user
  • Property mode set to 100644
File size: 628 bytes
Line 
1from ow.models.bulk import BulkFiles
2
3
4def migrate(root):
5    """
6    Adds the _bulk_files folder to the root object (a ow.models.BulkFiles
7    instance, see ticket #77 for more information)
8
9    >>> from ow.models.root import OpenWorkouts
10    >>> from ow.models.bulk import BulkFiles
11    >>> root = OpenWorkouts()
12    >>> '_bulk_files' in root.keys()
13    False
14    >>> migrate(root)
15    >>> '_bulk_files' in root.keys()
16    True
17    >>> isinstance(root['_bulk_files'], BulkFiles)
18    True
19    >>> len(root['_bulk_files'])
20    0
21    >>>
22    """
23    if '_bulk_files' not in root.keys():
24        root['_bulk_files'] = BulkFiles()
Note: See TracBrowser for help on using the repository browser.