I have defined optional variables in my django model. In my view, I might have those values or they might be None. I want to create that object without worrying about sending a None argument to the django model.
For example, Book object has a title, but publisher is optional.
right now in my view I'm doing something like
if publisher is None:
Book.objects.create(title=title)
else:
Book.objects.create(title=title, publisher=publisher)
Now this isn't manageable if there are multiple optional fields. What's the solution?