pinax / pinax-points

a points, positions and levels app for Django
MIT License
63 stars 19 forks source link

Fixed NOT NULL constraint failed: pinax_points_awardedpointvalue.points #22

Closed nollidnosnhoj closed 5 years ago

nollidnosnhoj commented 5 years ago

This exception is thrown when the admin tries to award points to a user from the Django admin.

This is because when saving the AwardedPointValue model, the points field (which is an Integer field) is NULL, which has the NOT NULL constraint.

I fixed this by adding a clean method in the AwardedPointValue, checking if the points value is null (None). If so, then it will replace the Null value with the value of the points key (value foreign key).

I tested this on my own project, and it worked. Will do more testing....

This is my first pull request to a project. I do not know how to do the testing stuff like TravisCl and such.

nollidnosnhoj commented 5 years ago

note, this will not do the TargetStat stuff like in award_points

nollidnosnhoj commented 5 years ago

This pull request won't work.