Luke Plant avatar Luke Plant committed d0c7c66

Better error message for min/max age

Comments (0)

Files changed (1)

cciw/bookings/models.py

         # Check age.
         camper_age = self.age_on_camp()
         if camper_age.years < self.camp.minimum_age:
-            errors.append(u"Camper will be below the minimum age (%d) on the 31st August %d"
-                          % (self.camp.minimum_age, self.camp.year))
+            errors.append(u"Camper will be %d which is below the minimum age (%d) on the 31st August %d"
+                          % (camper_age.years, self.camp.minimum_age, self.camp.year))
 
         if camper_age.years > self.camp.maximum_age:
-            errors.append(u"Camper will be above the maximum age (%d) on the 31st August %d"
-                          % (self.camp.maximum_age, self.camp.year))
+            errors.append(u"Camper will be %d which is above the maximum age (%d) on the 31st August %d"
+                          % (camper_age.years, self.camp.maximum_age, self.camp.year))
 
         # Check place availability
         places_left, places_left_male, places_left_female = self.camp.get_places_left()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.