diff --git a/app/models/groups.py b/app/models/groups.py index 7c87d442f..8b890a6ac 100644 --- a/app/models/groups.py +++ b/app/models/groups.py @@ -129,12 +129,8 @@ class GroupDescr(db.Model): def to_dict(self, with_partition=True) -> dict: """as a dict, with or without partition""" - d = { - "id": self.id, - "partition_id": self.partition_id, - "name": self.group_name, - "numero": self.numero, - } + d = dict(self.__dict__) + d.pop("_sa_instance_state", None) if with_partition: d["partition"] = self.partition.to_dict(with_groups=False) return d