Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » why pub_date is split to pub_date_date and pub_date_time [RSS Feed]

#1 Nov. 16, 2005 08:48:26

l.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

why pub_date is split to pub_date_date and pub_date_time


I want to use generic view to create my model polls's form html code,
but I found pub_date is split to pub_date_date and pub_date_time, I
want to know if there are some documents remind this. I used below
code:

{% for field in form.fields %}
{{field}}
{% endfor %}

and I want to know how to get field display name?

btw: polls model is the example from tutorial

--
I like python!
My Blog:http://www.donews.net/limodouNewEdit Maillist:http://groups.google.com/group/NewEdit

Offline

#2 Nov. 16, 2005 15:08:19

Robert W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

why pub_date is split to pub_date_date and pub_date_time


limodou wrote:
> I want to use generic view to create my model polls's form html code,
> but I found pub_date is split to pub_date_date and pub_date_time, I
> want to know if there are some documents remind this. I used below
> code:
>
> {% for field in form.fields %}
> {{field}}
> {% endfor %}
>
> and I want to know how to get field display name?
>
> btw: polls model is the example from tutorial
>
> --
> I like python!
> My Blog:http://www.donews.net/limodou> NewEdit Maillist:http://groups.google.com/group/NewEdit>

Fields can create multiple FormFields. This is why iterating over the
FormFields is not going to get you very satisfactory results for
autogenerating a form.

If you wish to autogenerate a form consistently, you can take a look at
how it is done by the admin in the new-admin branch. However, this part
is not yet documented and won't be until the API is fully baked. (Post
core fields removal.)

Robert

Offline

#3 Nov. 16, 2005 15:16:12

l.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

why pub_date is split to pub_date_date and pub_date_time


> Fields can create multiple FormFields.

So you mean Fields is not the same as FormFields, and the splited
FormFields can be combine again as auto saving to DB? But if I want to
manually create a form in template, what rule should I followed with ?
Is there some document?

> This is why iterating over the
> FormFields is not going to get you very satisfactory results for
> autogenerating a form.
>
> If you wish to autogenerate a form consistently, you can take a look at
> how it is done by the admin in the new-admin branch. However, this part
> is not yet documented and won't be until the API is fully baked. (Post
> core fields removal.)
>
> Robert
>

Thanks.

--
I like python!
My Blog:http://www.donews.net/limodouNewEdit Maillist:http://groups.google.com/group/NewEdit

Offline

#4 Nov. 16, 2005 15:45:07

Robert W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

why pub_date is split to pub_date_date and pub_date_time


limodou wrote:
>>Fields can create multiple FormFields.
>
>
> So you mean Fields is not the same as FormFields, and the splited
> FormFields can be combine again as auto saving to DB? But if I want to
> manually create a form in template, what rule should I followed with ?
> Is there some document?
>

This isn't very well documented right now.
See "http://www.djangoproject.com/documentation/model_api/";, under
DateTimeField:

"the admin represents this as two <input type="text"> fields, with
JavaScript shortcuts. "

It should probably be mentioned that this is not just in the admin, but
also in every automatically created manipulator.

>>This is why iterating over the
>>FormFields is not going to get you very satisfactory results for
>>autogenerating a form.
>>
>>If you wish to autogenerate a form consistently, you can take a look at
>>how it is done by the admin in the new-admin branch. However, this part
>>is not yet documented and won't be until the API is fully baked. (Post
>>core fields removal.)
>>
>>Robert
>>
>
>
> Thanks.
>
> --
> I like python!
> My Blog:http://www.donews.net/limodou> NewEdit Maillist:http://groups.google.com/group/NewEdit>

Offline

#5 Nov. 17, 2005 00:25:25

l.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

why pub_date is split to pub_date_date and pub_date_time


> This isn't very well documented right now.
> See "http://www.djangoproject.com/documentation/model_api/";, under
> DateTimeField:
>
> "the admin represents this as two <input type="text"> fields, with
> JavaScript shortcuts. "

But there are no JavaScript shortcuts in output code of generic view,
may be a bug?
>
> It should probably be mentioned that this is not just in the admin, but
> also in every automatically created manipulator.

Thanks you very much. I see.

--
I like python!
My Blog:http://www.donews.net/limodouNewEdit Maillist:http://groups.google.com/group/NewEdit

Offline

#6 Nov. 17, 2005 00:44:57

Robert W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

why pub_date is split to pub_date_date and pub_date_time


limodou wrote:
>>This isn't very well documented right now.
>>See "http://www.djangoproject.com/documentation/model_api/";, under
>>DateTimeField:
>>
>>"the admin represents this as two <input type="text"> fields, with
>>JavaScript shortcuts. "
>
>
> But there are no JavaScript shortcuts in output code of generic view,
> may be a bug?

You can include the javascript from the admin in your own app.

>>It should probably be mentioned that this is not just in the admin, but
>>also in every automatically created manipulator.
>
>
> Thanks you very much. I see.
>
> --
> I like python!
> My Blog:http://www.donews.net/limodou> NewEdit Maillist:http://groups.google.com/group/NewEdit>

Offline

#7 Nov. 17, 2005 00:55:09

l.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

why pub_date is split to pub_date_date and pub_date_time


2005/11/17, Robert Wittams <>:
>
> limodou wrote:
> >>This isn't very well documented right now.
> >>See "http://www.djangoproject.com/documentation/model_api/";, under
> >>DateTimeField:
> >>
> >>"the admin represents this as two <input type="text"> fields, with
> >>JavaScript shortcuts. "
> >
> >
> > But there are no JavaScript shortcuts in output code of generic view,
> > may be a bug?
>
> You can include the javascript from the admin in your own app.
>

Ok, thanks.


--
I like python!
My Blog:http://www.donews.net/limodouNewEdit Maillist:http://groups.google.com/group/NewEdit

Offline

  • Root
  • » Django
  • » why pub_date is split to pub_date_date and pub_date_time [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support