IS_IN_SET({6 : "6 months", 12 : "1 year", 24: "2 years"}) for your 
contract_length and then

contract_start + datetime.timedelta(days=contract_length*30)   



On Tuesday, April 16, 2013 8:34:45 AM UTC+2, Michael Herman wrote:
>
> The logic makes sense in Rails. Something isn't quite clicking with DAL. 
>
> class Event < ActiveRecord::Base
>   # Sets the end_date to be +duration+ months after the start_date
>   def duration=(duration)
>     self.end_date = self.start_date + duration.to_i.months
>   end
> end
>
> <%= form_for(@event) do |f| %>
>   <%= f.date_select :start_date %>
>   <%= f.select :duration, [["6 months", 6], ["1 year", 12], ["2 years", 
> 24]] %>
>   <%= f.submit %>
> <% end %>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to