79351471

Date: 2025-01-13 07:54:31
Score: 0.5
Natty:
Report link

I was able to solve the problem by explicitly stating that there was a change in the object

def update_place_other_storage_key_by_place_code(self, place_code: int, other: str) -> None:
    session = Session()
    query = select(Place).where(Place.place_code == place_code)
    result = session.execute(query)
    place = result.scalars().first()

    if place:
        if place.other_storage_key:
            place.other_storage_key.append(other)
        else:
            place.other_storage_key = [other]

    flag_modified(place, 'other_storage_key')
    session.commit()

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Ruzel