We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce8989d commit dd411b5Copy full SHA for dd411b5
frameworks/Python/aiohttp/app/views.py
@@ -7,6 +7,7 @@
7
import ujson
8
from aiohttp.web import Response, json_response
9
from sqlalchemy import select
10
+from sqlalchemy.orm.attributes import flag_modified
11
12
from .models import sa_fortunes, sa_worlds, Fortune, World
13
@@ -137,6 +138,9 @@ async def updates(request):
137
138
for id_, number in updates:
139
world = await sess.get(World, id_, populate_existing=True)
140
world.randomnumber = number
141
+ # Force sqlalchemy to UPDATE entry even if the value has not changed
142
+ # doesn't make sense in a real application, added only to pass tests.
143
+ flag_modified(world, "randomnumber")
144
return json_response(worlds)
145
146
async def updates_raw(request):
0 commit comments