projects
/
zzz-floof.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
tagging works
[zzz-floof.git]
/
floof
/
lib
/
dbhelpers.py
diff --git a/floof/lib/dbhelpers.py
b/floof/lib/dbhelpers.py
new file mode 100644
(file)
index 0000000..
4d10030
--- /dev/null
+++ b/
floof/lib/dbhelpers.py
@@ -0,0
+1,5
@@
+def find_or_create(model, **kwargs):
+ instance = model.get_by(**kwargs)
+ if not instance:
+ instance = model(**kwargs)
+ return instance
\ No newline at end of file