﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30053	Allow for conditional QuerySet.update_or_create()	Joshua Cannon	nobody	"{{{QuerySet.update_or_create()}}} is great since it lifts the burden of thread-safety and repeated code from the client. However there exists some scenarios where the ""update"" logic should be hidden behind a condition. (E.g. only update if the value of a {{{DateTimeField}}} is less than some value). There isn't much help for clients in these scenarios, with the best solution being to copy+paste {{{QuerySet.update_or_create()}}} and add a condition to the {{{if created:}}} expression.

The condition would most likely be a callable that accepts one argument, the {{{got}}}ten instance.

The solution should be trivial, either:
A. Add a ""condition"" parameter to {{{update_or_create()}}} (along with logic to make the feature backwards compatible, likely checking if the value is callable with one argument or not, since ""condition"" could be a field)
B. Add another method, and re-write {{{update_or_create()}}} in terms of the new method with a condition that is always true.
"	New feature	new	Database layer (models, ORM)	dev	Normal		QuerySet update_or_create		Unreviewed	0	0	0	0	0	0
