1 from plstackapi.core.models import Site
5 def __init__(self, api):
11 db_sites = Site.objects.all()
12 for db_site in db_sites:
13 self.local_sites[db_site.login_base] = db_site
14 print "%s local sites" % len(db_sites)
16 sites = self.api.GetSites()
17 print "%s remote sites" % len(sites)
20 self.remote_sites[site['site_id']] = site
21 if site['login_base'] not in self.local_sites:
22 new_site = Site(name=site['name'],
23 login_base=site['login_base'],
25 enabled=site['enabled'],
26 longitude=site['longitude'],
27 latitude=site['latitude'],
28 is_public=site['is_public'],
29 abbreviated_name=site['abbreviated_name'])
32 self.local_sites[new_site.login_base] = new_site
33 print "imported %s sites" % count