Re: How to use month/date/year menus for date?

2006-09-03 Thread Sean Schertell

> On 9/3/06, Jakub 'teodor' Krajniak <[EMAIL PROTECTED]> wrote:
>> Sean Schertell wrote:
>> (...)
>>> The question is, how can I get those three menus to create a single
>>> date object that plays nice with Django?
>>
>> I think that writing CustomForm with SelectFields would be good idea.
>> Next in views or in overwritten save() method,
>> you could join data from those fields into one date field and save  
>> it.
>> See in django source how is written ChangeManipulator.
>
> I would also use a custom form.
>
> Also, if there are more than two or three date fields, it may be
> worthwhile coding up your own subclass of  django.forms.FormField or
> django.forms.HiddenField, which renders the three drop-down lists and
> does the validation.
>
> Alan.

Thanks Alan and Jakub. It seems like I've found the first chink in  
the armor. In my opinion, the worst sin a framework can commit is  
getting in the way of accomplishing basic, simple tasks making you  
work *harder* to accomplish something that's normally easy. This  
looks like one of those cases :-(

Oh well, off to research CustomForm with SelectFields -- hopefully  
it's easier than it sounds.

Thanks for the tips,
Sean



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



Re: How to use month/date/year menus for date?

2006-09-03 Thread Alan Green

On 9/3/06, Jakub 'teodor' Krajniak <[EMAIL PROTECTED]> wrote:
> Sean Schertell wrote:
> (...)
> > The question is, how can I get those three menus to create a single
> > date object that plays nice with Django?
>
> I think that writing CustomForm with SelectFields would be good idea.
> Next in views or in overwritten save() method,
> you could join data from those fields into one date field and save it.
> See in django source how is written ChangeManipulator.

I would also use a custom form.

Also, if there are more than two or three date fields, it may be
worthwhile coding up your own subclass of  django.forms.FormField or
django.forms.HiddenField, which renders the three drop-down lists and
does the validation.

Alan.


>
> Regards,
>Jakub
>
>
> >
>


-- 
Alan Green
[EMAIL PROTECTED] - http://bright-green.com

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



Re: How to use month/date/year menus for date?

2006-09-03 Thread Sean Schertell

Thanks for the tips folks. I'm a little surprised that Django makes  
you work so hard to make such a totally standard form element (a date  
as three pulldown menus). Is there really no easier method?

Sean



On Sep 3, 2006, at 1:31 AM, Jakub 'teodor' Krajniak wrote:

>
>
> Sean Schertell wrote:
> (...)
>> In my view, I'm using FormWrapper and that automatically makes a text
>> field for the date where the user is expected to enter the date as
>> -mm-dd. Personally, I think that's not the most user friendly way
>> to collect a date from the user. I like the more typical method of
>> having three select menus: one for month, one for date, and one for
>> year.
>>
>> The question is, how can I get those three menus to create a single
>> date object that plays nice with Django?
>
> I think that writing CustomForm with SelectFields would be good idea.
> Next in views or in overwritten save() method,
> you could join data from those fields into one date field and save it.
> See in django source how is written ChangeManipulator.
>
> Regards,
>Jakub
>
>
> >
>
>


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



Re: How to use month/date/year menus for date?

2006-09-02 Thread Jakub 'teodor' Krajniak


Sean Schertell wrote:
(...)
> In my view, I'm using FormWrapper and that automatically makes a text
> field for the date where the user is expected to enter the date as
> -mm-dd. Personally, I think that's not the most user friendly way
> to collect a date from the user. I like the more typical method of
> having three select menus: one for month, one for date, and one for
> year.
>
> The question is, how can I get those three menus to create a single
> date object that plays nice with Django?

I think that writing CustomForm with SelectFields would be good idea.
Next in views or in overwritten save() method,
you could join data from those fields into one date field and save it.
See in django source how is written ChangeManipulator.

Regards,
   Jakub


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



Re: How to use month/date/year menus for date?

2006-09-02 Thread viestards

> The question is, how can I get those three menus to create a single
> date object that plays nice with Django?
>

I think the easyest way will be to format selected day, month, year
with Javascript, but definetly not the best. May be write a custom
Validator.

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



Re: How to use month/date/year menus for date?

2006-09-01 Thread Sean Schertell

Sorry, perhaps someone can clarify this for me -- or maybe I didn't  
ask my question very clearly.

I have a model called Event. In that model, I have a line that looks  
like this:
date = models.DateField()

In my view, I'm using FormWrapper and that automatically makes a text  
field for the date where the user is expected to enter the date as  
-mm-dd. Personally, I think that's not the most user friendly way  
to collect a date from the user. I like the more typical method of  
having three select menus: one for month, one for date, and one for  
year.

The question is, how can I get those three menus to create a single  
date object that plays nice with Django?

Thanks,
Sean



On Sep 1, 2006, at 11:55 PM, coulix wrote:

>
> Building a menu i dont know,
> bu getting the data yes
>
> exemple the month list of a Entry model with a create date field.
>
> month_list =  Entry.objects.dates('created', 'month')
>
>
> >
>
>


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



Re: How to use month/date/year menus for date?

2006-09-01 Thread coulix

Building a menu i dont know,
bu getting the data yes

exemple the month list of a Entry model with a create date field.

month_list =  Entry.objects.dates('created', 'month')


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



How to use month/date/year menus for date?

2006-09-01 Thread Sean Schertell

Hi,

My model has a date field in it and I want to collect that data in my  
form with a more traditional method than the default text field that  
the FormWrapper generates. I want to use three select menus with  
month/date/year pulldowns. What the best way to do this while keeping  
my model happy?

Thanks in advance,
Sean

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