|
7 | 7 |
|
8 | 8 | import os |
9 | 9 |
|
| 10 | + |
10 | 11 | class DatasetModel(DynamicDocument): |
11 | 12 |
|
12 | 13 | id = SequenceField(primary_key=True) |
@@ -40,36 +41,14 @@ def save(self, *args, **kwargs): |
40 | 41 | self.owner = 'system' |
41 | 42 |
|
42 | 43 | return super(DatasetModel, self).save(*args, **kwargs) |
| 44 | + |
| 45 | + def get_users(self): |
| 46 | + from .users import UserModel |
43 | 47 |
|
44 | | - # def download_images(self, keywords, limit=100): |
45 | | - |
46 | | - # task = TaskModel( |
47 | | - # name="Downloading {} images to {} with keywords {}".format(limit, self.name, keywords), |
48 | | - # dataset_id=self.id, |
49 | | - # group="Downloading Images" |
50 | | - # ) |
51 | | - |
52 | | - # def download_images(task, dataset, keywords, limit): |
53 | | - # def custom_print(string): |
54 | | - # __builtins__.print("%f -- %s" % (time.time(), string)) |
55 | | - |
56 | | - # print = dprint |
57 | | - # task.log() |
58 | | - # for keyword in args['keywords']: |
59 | | - # response = gid.googleimagesdownload() |
60 | | - # response.download({ |
61 | | - # "keywords": keyword, |
62 | | - # "limit": args['limit'], |
63 | | - # "output_directory": output_dir, |
64 | | - # "no_numbering": True, |
65 | | - # "format": "jpg", |
66 | | - # "type": "photo", |
67 | | - # "print_urls": False, |
68 | | - # "print_paths": False, |
69 | | - # "print_size": False |
70 | | - # }) |
71 | | - |
72 | | - # return task |
| 48 | + members = self.users |
| 49 | + members.append(self.owner) |
| 50 | + |
| 51 | + return UserModel.objects(username__in=members).exclude('password', 'id', 'preferences') |
73 | 52 |
|
74 | 53 | def import_coco(self, coco_json): |
75 | 54 |
|
|
0 commit comments