Raising an error for slug unique in django
Edit: I didn't realize that you did not want to save the form to the database. It's obvious now, sorry. So this answer no longer applies. But why don't you try to save the actual Question object instead?



This should work, and there's no reason to change if you validated that it does work with tests.

However it would be more Pythonic to actually try saving (without commit=False), then catching the resulting django.db.IntegrityError exception. See EAFP to understand why this is more Pythonic. The happy path will be faster too since you only need to call the database once.