Guest User

Untitled

a guest
Oct 19th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. full_time_equivalent = models.DecimalField(
  2. max_digits=5,
  3. decimal_places=2,
  4. default=100,
  5. validators=[
  6. MinValueValidator(Decimal(0)),
  7. MaxValueValidator(Decimal(100))
  8. ]
  9. )
  10.  
  11. def save(self, *args, **kwargs):
  12. # Run validations
  13. self.full_clean()
  14. return super().save(*args, **kwargs)
  15.  
  16. project2_membership = ProjectMembership(
  17. user=self.new_user,
  18. project=project2,
  19. is_project_manager=False,
  20. full_time_equivalent=10.01
  21. )
  22.  
  23. Decimal('10.0099999999999997868371792719699442386627197265625')
  24.  
  25.  
  26. django.core.exceptions.ValidationError:
  27. {'full_time_equivalent': ['Ensure that there are no more than 5 digits in total.']
Add Comment
Please, Sign In to add comment