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.
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment