14

I'm trying to set a default value for the integer field in Django model using

models.PositiveSmallIntegerField(default='0')

Why isn't it working?

1 Answer 1

33

The default value in your example is set to string ('0'), but it should be integer. Try this instead:

models.PositiveSmallIntegerField(default=0)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.