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 CharField where the user enters details for
the number_of_hours.
So i want to know what type of model field should i create CharField or
Time Field.

If i   go for CharField it will simply save the details like 0900-1800. So
if i need to know how many hours that particular person is available for
work then how will subtract that from CharField.

So i need help to know what exactly the field i should create such that it
satisfies the template look and backened queries also.



On Fri, Jun 29, 2012 at 2:18 PM, Jon Black <jon_bl...@mm.st> wrote:

>  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 views, I tend to put it in form_valid().
>
>  Apologies if I've misunderstood :)
>
>  --
>  Jon Black
>  www.jonblack.org
>
>
>  On Fri, Jun 29, 2012, at 10:16, Nikhil Verma wrote:
>
>
>  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_hours_of_operation( no. of hours that an institute works)
>
>
> class UserProfile(models.Model):
>     user = models.ForeignKey(User, blank=True, null=True, unique=True)
>     first_name = models.CharField(max_length=30, blank=True)
>     last_name = models.CharField(max_length=30, blank=True)
>     gender = models.CharField(max_length=1, choices=GENDER_CHOICES,
> blank=True)
>     birth_date = models.DateField(auto_now_add=True)
>     street_address = models.CharField(max_length=75, blank=True)
>     city = models.CharField(max_length=30, blank=True)
>     zip_code = models.IntegerField(max_length=7, blank=True, null=True)
>     country = models.CharField(max_length=30, blank=True)
>     mobile = models.CharField(max_length=15, blank=True)
>     home_phone = models.CharField(max_length=15, blank=True)
>     primary_email = models.EmailField(max_length=60, blank=True)
>     secondary_email = models.EmailField(max_length=60, blank=True)
>     institution_name =
> models.CharField(max_length=100,blank=True,null=True)
>     institution_website =
> models.CharField(max_length=100,blank=True,null=True)
>
>
> # Field to be added
>
> It will be displayed in html like this
>
> Insitutue hour of operation :       Monday  9.00 - 17.00 (Monday will be
> hardcoded,Time will be filled by user)
>                                               Tuesday 9.00 - 17.00
> (Monday will be hardcoded,Time will be filled by user)
>
>                                                and so on
>
> # Note the weekdays like monday,  tuesday they are all hardcoded as
> requirement but i don't want that to be hardcoded.
> Also i am using a django forms  to display this.
>
>
> 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.
>
>
> Thanks in advance.
>
>
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to