Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Nikhil Verma
Thanks for the help guys. On Fri, Jun 29, 2012 at 11:37 AM, Sunny Nanda wrote: > One way to store such information can be like this: > Create a model "Day". This will hold entries for each day i.e. from Monday > till Sunday > In the UserProfile model, create a ManyToMany relation to the above >

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Sunny Nanda
One way to store such information can be like this: Create a model "Day". This will hold entries for each day i.e. from Monday till Sunday In the UserProfile model, create a ManyToMany relation to the above defined Day model through an intermediate table (say WorkingHours) which can hold the "fr

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread jonas
Nikhil Verma wrote: How can i design this form field as well in models or What should be the type of this field both in models and forms such that weekdays remain dynamic(i can simply generate them from loop) and the user can fill the timeĀ  and when he hits submit it will get saved. I would c

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Melvyn Sopacua
On 29-6-2012 11:01, Nikhil Verma wrote: > Yes it is the count of the hours.They will enter in the following manner "- > > Monday : 0900-1800, Tuesday and so on ... This will be entered by the user > who is filling the form. > > Now the text Moday(weekdays can be hardcoded but i personally don't

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Jon Black
If the days have to be hardcoded (I imagine you have a row/field for each day), then you could use a hardcoded string for the day (not editable nor related to your model), and provide two Time fields. Using Time gives you advantages: * You can use python's DateTime module to calculate the hours *

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Nikhil Verma
Hi Jon Yes it is the count of the hours.They will enter in the following manner "- Monday : 0900-1800, Tuesday and so on ... This will be entered by the user who is filling the form. Now the text Moday(weekdays can be hardcoded but i personally don't want.) Now if you see this is a simple CharFi

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Jon Black
I understand that institue_hours_of_operation is a count of the hours the user has worked, is that correct? If so, I suppose you just need to count the hours with each form submition and add that to the current institue_hours_of_operation value. You can do that logic in a few places. In class-based

how to manage range of hours in models and forms in django1.4

2012-06-28 Thread Nikhil Verma
Hi I am developing an event app which has users who publish events , other users also. Now users have their profile info for which i have made a very common UserProfile Model with all the necessary details in it. I have a requirement where in UserProfile model i need to display a field institue_h