1๐
โ
My guess is that in CreateAuditForm.clean
, user
is None
because clean_user
raised a ValidationError
. The ValidationError
comes from the fact that the user does not have the groups he needs.
Another issue I see is that to test equality between model instances in Django, you should not use primary keys but test using the instances directly, using ==
and not is
. (See https://stackoverflow.com/a/13650309/1644198 for more information on is
and ==
)
Example:
if user != userwebsite.user:
# etc...
๐คaumo
Source:stackexchange.com