Ejemplo n.º 1
0
    def save(self, *args, **kwargs):
        created = self.pk is None

        # save the object
        super(Group, self).save(*args, **kwargs)

        if created:
            log.add(self, 'Created')
        for field in self._tracker.changed():
            log.field_change(self, field=field, new_value=getattr(self, field))

        old_name = self._tracker.previous("name")
        new_name = self.name
        if old_name is not None and old_name != new_name:
            from karaage.datastores import global_set_group_name
            global_set_group_name(self, old_name, new_name)
            from karaage.datastores import machine_category_set_group_name
            machine_category_set_group_name(self, old_name, new_name)
            log.change(self, "Renamed group")

        # update the datastore
        from karaage.datastores import global_save_group
        global_save_group(self)
        from karaage.datastores import machine_category_save_group
        machine_category_save_group(self)
Ejemplo n.º 2
0
    def save(self, *args, **kwargs):
        created = self.pk is None

        # save the object
        super(Group, self).save(*args, **kwargs)

        if created:
            log.add(self, 'Created')
        for field in self._tracker.changed():
            log.field_change(self, field=field, new_value=getattr(self, field))

        old_name = self._tracker.previous("name")
        new_name = self.name
        if old_name is not None and old_name != new_name:
            from karaage.datastores import global_set_group_name
            global_set_group_name(self, old_name, new_name)
            from karaage.datastores import machine_category_set_group_name
            machine_category_set_group_name(self, old_name, new_name)
            log.change(self, "Renamed group")

        # update the datastore
        from karaage.datastores import global_save_group
        global_save_group(self)
        from karaage.datastores import machine_category_save_group
        machine_category_save_group(self)