コード例 #1
0
ファイル: models.py プロジェクト: nikolay/apostello
    def fetch_all_groups():
        """Pull all group names and ids from Elvanto."""
        data = elvanto("groups/getAll")
        if data['status'] != 'ok':
            raise ElvantoException

        for grp in data['groups']['group']:
            grp_obj = ElvantoGroup.objects.get_or_create(e_id=grp['id'])[0]
            grp_obj.name = grp['name']
            grp_obj.save()
コード例 #2
0
ファイル: models.py プロジェクト: bonganim911/apostello
    def fetch_all_groups():
        """Pull all group names and ids from Elvanto."""
        data = elvanto("groups/getAll")
        if data['status'] != 'ok':
            raise ElvantoException

        for grp in data['groups']['group']:
            grp_obj = ElvantoGroup.objects.get_or_create(e_id=grp['id'])[0]
            grp_obj.name = grp['name']
            grp_obj.save()
コード例 #3
0
    def fetch_all_groups():
        """Pull all group names and ids from Elvanto."""
        data = elvanto("groups/getAll")
        if data["status"] != "ok":
            raise ElvantoException

        for grp in data["groups"]["group"]:
            grp_obj = ElvantoGroup.objects.get_or_create(e_id=grp["id"])[0]
            grp_obj.name = grp["name"]
            grp_obj.save()
コード例 #4
0
ファイル: models.py プロジェクト: nikolay/apostello
    def pull(self):
        """Pull group from Elvanto into related apostello group."""
        apostello_group = self.create_apostello_group()
        data = elvanto("groups/getInfo", id=self.e_id, fields=['people'])
        if data['status'] != 'ok':
            raise ElvantoException

        if data['group'][0]['people']:
            for prsn in data['group'][0]['people']['person']:
                ElvantoGroup.add_person(apostello_group, prsn)

        apostello_group.save()
        self.last_synced = timezone.now()
        self.save()
コード例 #5
0
ファイル: models.py プロジェクト: bonganim911/apostello
    def pull(self):
        """Pull group from Elvanto into related apostello group."""
        apostello_group = self.create_apostello_group()
        data = elvanto("groups/getInfo", id=self.e_id, fields=['people'])
        if data['status'] != 'ok':
            raise ElvantoException

        if data['group'][0]['people']:
            for prsn in data['group'][0]['people']['person']:
                ElvantoGroup.add_person(apostello_group, prsn)

        apostello_group.save()
        self.last_synced = timezone.now()
        self.save()