blob: 02247f1e5a6ef45f91779a0b27f39712a22690f5 [file] [log] [blame]
Tony Mackf593dba2013-03-24 13:17:43 -04001from PLC.Slices import Slices
2from models import Slice
3
4class SliceImporter:
5
6 def __init__(self, importer):
7 self.importer = importer
8 self.slices = {}
9
10 def run(self):
11 slices = Slices(self.importer.api)
12 db_slices = Slice.objects.all()
13 slice_names = [s['name'] for s in db_slices]
14 for slice in slices:
15 if slice['name'] not in slice_names:
16 new_slices = Slice(name=slice['name'],
17 instantiation=slice['instantiation'],
18 omf_friendly = False,
19 description = slice['description'],
20 slice_url = slice['url'])
21 new_slice.save();
22 self.slices[slice['slice_id']] = slice
23
24
25