I've implemented a UserProfile model (as the Django 1.2 docs say is the proper way to save additional data about a User) which has a 'remaining_vacation_hours' field.
In our current system, when a user fills out a Time Off Request, the remaining hours available should be checked to see that they have enough vacation to use, or otherwise be warned that they are asking for more than they have.
Of course, vacation hours are annually replenished, so it would be appropriate for the system to check if the user would have additional vacation accrued for the dates they're asking off.
Simply creating a get_remaining_vacation_hours()
method would suffice, because other calculations or business logic that might need to be added in the future could be added to or called from that method.
My question is, does it sound correct that the get_remaining_vacation_hours()
method be added to the UserProfile model?
It seems to make sense, but I wanted to verify with the community that I wasn't overlooking a better practice for this type of thing. Any ideas or suggestions are welcome.