Create if doesn't exist

user1094786 picture user1094786 · Jan 7, 2012 · Viewed 46.7k times · Source

I have a Django application that reads data from a web API and puts it in a database.
Is there a way to create a new object from a mode but prevent the duplicate exception if the object already exists?

In other words, is there a way to save an object, but to just do nothing if it already exists?

Answer