1👍
✅
Your original solution was not good because you were missing the user
positional argument in the form init function.
Secondly, your CourseForm
class should specify the rest of the fields (id
, and user
) if you want to pass them to the form.
You could probably just not pass id
and user
to the CourseForm
data in the test as they aren’t relevant.
This should work:
def test_CourseUpdate_valid(self):
form = CourseForm(self.user, data={
'course_name': "Science",
'grade_level': "SEC"
},)
self.assertTrue(form.is_valid())
Can you try that and let me know if the problem persists?
Source:stackexchange.com