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 create an extra Model which defines these opening times:

class OpeningTimes(models.Model):
    day = models.CharField(max_length=10)
    start = models.DateTimeField()
    end = models.DateTimeField()

and define a manytomany relation ship from the UserProfile to your OpeningTimes model.

I've opted for the DateTimeField here, there's no Time Field in django by default. But you could just use any date (maybe use some kind of default date or use the current date) and make sure the time has been filled in correctly. And then just extract the right hour from the DateTime field.

Regards,

Jonas;

--
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