Sync util big update
This commit is contained in:
1 parent
1e80bae401
commit
40321327d6
30 files changed
+1001
-159
No files matched your search
@@ -0,0 +1,21 @@
|
||||
__author__ = 'Roman Timashev'
|
||||
|
||||
|
||||
class Album:
|
||||
def __init__(self, type, title, uri, course, course_uri, date, teacher, comment):
|
||||
super().__init__()
|
||||
self.products = []
|
||||
self.type = type
|
||||
self.title = title
|
||||
self.uri = uri
|
||||
self.course = course
|
||||
self.course_uri = course_uri
|
||||
self.date = date
|
||||
self.teacher = teacher
|
||||
self.comment = comment
|
||||
|
||||
def add_product(self, product):
|
||||
self.products.append(product)
|
||||
|
||||
def __repr__(self, *args, **kwargs):
|
||||
return '[%s by %s (%d items)]' % (self.title, self.teacher, len(self.products))
|
||||
@@ -0,0 +1,8 @@
|
||||
# JSON
|
||||
# {
|
||||
# "assigned": "\\(author)",
|
||||
# "file": "1 diploma.jpg"
|
||||
# }
|
||||
def create_award(doc):
|
||||
return {**doc}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
from sync.image import sync_image
|
||||
from utils.fn import key_mapper
|
||||
|
||||
|
||||
unpop_image = key_mapper('image', lambda i: sync_image(i)['_id'])
|
||||
|
||||
|
||||
def create_product(doc):
|
||||
# author, image, title, awards, teacher, date
|
||||
|
||||
product = {**doc}
|
||||
unpop_image(product)
|
||||
|
||||
return product
|
||||
Reference in new issue
Block a user