Last active
June 13, 2021 15:22
-
-
Save mark-mishyn/3c4155245670d31df8dd6d5579b23f81 to your computer and use it in GitHub Desktop.
Append value to DB column with Django ORM with 1 QB query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import F, Value | |
from django.db.models.functions import Concat | |
# only one SQL query | |
User.objects.filter(id=user.id).update(description=Concat(F('description'), Value('some note to append'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment