Creating a Post instance

In creating a Post instance, why is content not required? We didn't create this field with blank=True or a default argument.

Another question is, the first time we run coverage run ... -before writing any tests -the coverage report gives blog/models 77%. That makes me think that this number is misleading, or perhaps I'm misunderstanding?

Thanks

Sorry You must be a logged in, registered user to answer a question.

Answers

In my admin, the Content field is required.

As for coverage, it seems there's some bleed-through on tests and you're seeing that the functionality of the model is already tested by Django's tests, so it's working correctly. Our tests would then test the custom bits we've added. But, yes, it feels a bit misleading. Coverage isn't the only metric you should use for if you're testing enough or not.

Re. the `content` field, ah yes apologies, `blank` is purely validation-related, it doesn't relate to how you create a `Post` programatically.
myprecious on