Re: models and forms

2019-04-29 Thread Nelson Varela
What do you have so far. show some code or explain what you have so far

On Monday, April 22, 2019 at 1:40:06 PM UTC+2, Shereyne Casimsiman wrote:
>
> I am current making a project and django is very new to me, I've been 
> following tutorials but it did not answer my concern..
> My project is to build a quiz that will have an audio as the question . I 
> already installed  the django-audiofield and successfully added it into the 
> admin but my problem is that I don't know how to show it in the templates 
> please help me ... I am running out of time  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c126f0ba-21c3-4123-9a43-37fd92121bd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


models and forms

2019-04-22 Thread Shereyne Casimsiman
I am current making a project and django is very new to me, I've been 
following tutorials but it did not answer my concern..
My project is to build a quiz that will have an audio as the question . I 
already installed  the django-audiofield and successfully added it into the 
admin but my problem is that I don't know how to show it in the templates 
please help me ... I am running out of time  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7bde61fb-7479-4c7a-a9a4-b8c88f06f6e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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
> defined Day model through an intermediate table (say WorkingHours) which
> can hold the "from" and "to" time.
>
> Partial example below:
>
> class UserProfile(models.Model):
>> working_hours = models.ManyToManyField("Day", through="WorkingHours")
>>
>> class WorkingHours(models.Model)
>> profile = models.ForeignKey("UserProfile")
>> day = models.ForeignKey("Day")
>> from_time = models.**TimeField()
>> to_time = models.**TimeField()
>>
>
> While creating the forms, take input from the user for the WorkingHours
> model. This way, the days of work will not be hardcoded, and user can
> select mutiple choices.
>
> Regards,
> Sandeep
>
>
>
> On Friday, June 29, 2012 10:16:47 AM UTC+5:30, 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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/N2ArPbWtQmYJ.
>
> 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.



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 "from" and "to" time.

Partial example below:

class UserProfile(models.Model):
> working_hours = models.ManyToManyField("Day", through="WorkingHours")
>
> class WorkingHours(models.Model)
> profile = models.ForeignKey("UserProfile")
> day = models.ForeignKey("Day")
> from_time = models.**TimeField()
> to_time = models.**TimeField()
>

While creating the forms, take input from the user for the WorkingHours 
model. This way, the days of work will not be hardcoded, and user can 
select mutiple choices.

Regards,
Sandeep


On Friday, June 29, 2012 10:16:47 AM UTC+5:30, 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/N2ArPbWtQmYJ.
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.



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



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 want.)

Untested, but I'd try this:
class DaysOfWeek(models.Model) :
name = models.CharField(max_length=32)

class BusinessHours(models.Model) :
day = models.ForeignKey(DaysOfWeek)
start = models.TimeField()
end = models.TimeField()

class Institute(models.Model) :
   # ...
   business_hours = models.ManyToManyField(BusinessHours)

Not sure if the Admin handles this ok though. An alternative:
class DaysOfWeek(models.Model) :
name = models.CharField(max_length=32)

def __iter__(self) :
return self

def next(self) :
for entry in DaysOfWeek.objects.all() :
 return (entry.id, entry.name)

class BusinessHours(models.Model) :
day = models.CharField(max_length=32, choices=DaysOfWeek)
start = models.TimeField()
end = models.TimeField()

-- 
Melvyn Sopacua


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



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
* You can more easily use a funky date/time style widget if you
ever need it
* You will avoid making mistakes trying to calculate the hours
manually
* You can validate the form data using python's date/time module

If you're really open to suggestions (just thinking outside the
box, and possible outside of the scope), but you could use a
separate table to record all hours recorded rather than just
counting the hours as they're entered.

--
Jon Black
www.jonblack.org


On Fri, Jun 29, 2012, at 14:31, Nikhil Verma wrote:

  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 <[1]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
[2]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
  [3]django-users@googlegroups.com.
  To unsubscribe from this group, send email to
  [4]django-users+unsubscr...@googlegroups.com.
  For more options, visit this group at
  [5]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
  [6]django-users@googlegroups.com.

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



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



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



Re: Trying to reuse models and forms

2007-12-12 Thread Kirk Strauser
On Wednesday 12 December 2007, l5x wrote:
> form_for_instance? Check:
> http://www.djangoproject.com/documentation/newforms/#generating-forms-for
>-models

That's only in the SVN version, but if we have to move from .96 to SVN to 
get it then so be it.
-- 
Kirk Strauser


signature.asc
Description: This is a digitally signed message part.


Re: Trying to reuse models and forms

2007-12-12 Thread l5x

form_for_instance? Check: 
http://www.djangoproject.com/documentation/newforms/#generating-forms-for-models
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Trying to reuse models and forms

2007-12-12 Thread Kirk Strauser
I have a user profile model that gets accessed from the admin section of my 
site:

class UserProfile(models.Model):
MARKETS = [('B', 'Both'),
   ('D', 'Domestic'),
   ('I', 'International')]

market = models.CharField(maxlength=1, choices=MARKETS, core=True)

When viewed in /admin, that field appears as the expected select widget.  
I'm trying to wrap this (and a few other models) into a user-editable page 
elsewhere on the site, but it's giving me fits:

>>> form = newforms.form_for_instance(umod.UserProfile())()
>>> print form['market']


Is there a way to get it to render as a select widget with the same values 
as in /admin?  I'm going to be doing such things quite a few times and I 
don't want to have to repeat the same definitions in a bunch of places.

Many thanks,
-- 
Kirk Strauser


signature.asc
Description: This is a digitally signed message part.