just write d=models.DateField() in yor models.py file On Mon, Jun 25, 2012 at 2:38 PM, ledzgio <giorgiomarci...@gmail.com> wrote:
> Very useful, thanks. > But how can I change the date format also in the admin interface when > using DateField? > > Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto: > >> On 25/06/2012 6:51pm, ledzgio wrote: >> > How can I change default project/app date format to dd-mm-YYYY? >> >> This is straight from the Python 2.7 docs. >> >> >>>import datetime >> >>>d = datetime.datetime(2010, 7, 4, 12, 15, 58) >> >>> '{:%Y-%m-%d%H:%M:%S}'.format(**d) >> '2010-07-04 12:15:58' >> >> or in a template ... >> https://docs.djangoproject.**com/en/dev/ref/templates/**builtins/#date<https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date> >> >> hth >> >> Mike >> >> > >> > thanks >> > -- >> > 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/-/**Z3fcdtqKpvYJ<https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ>. >> >> > 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<django-users%2bunsubscr...@googlegroups.com>. >> >> > For more options, visit this group at >> > http://groups.google.com/**group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>. >> >> >> >> > Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto: > >> On 25/06/2012 6:51pm, ledzgio wrote: >> > How can I change default project/app date format to dd-mm-YYYY? >> >> This is straight from the Python 2.7 docs. >> >> >>>import datetime >> >>>d = datetime.datetime(2010, 7, 4, 12, 15, 58) >> >>> '{:%Y-%m-%d%H:%M:%S}'.format(**d) >> '2010-07-04 12:15:58' >> >> or in a template ... >> https://docs.djangoproject.**com/en/dev/ref/templates/**builtins/#date<https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date> >> >> hth >> >> Mike >> >> > >> > thanks >> > -- >> > 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/-/**Z3fcdtqKpvYJ<https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ>. >> >> > 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<django-users%2bunsubscr...@googlegroups.com>. >> >> > For more options, visit this group at >> > http://groups.google.com/**group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>. >> >> >> >> > Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto: > >> On 25/06/2012 6:51pm, ledzgio wrote: >> > How can I change default project/app date format to dd-mm-YYYY? >> >> This is straight from the Python 2.7 docs. >> >> >>>import datetime >> >>>d = datetime.datetime(2010, 7, 4, 12, 15, 58) >> >>> '{:%Y-%m-%d%H:%M:%S}'.format(**d) >> '2010-07-04 12:15:58' >> >> or in a template ... >> https://docs.djangoproject.**com/en/dev/ref/templates/**builtins/#date<https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date> >> >> hth >> >> Mike >> >> > >> > thanks >> > -- >> > 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/-/**Z3fcdtqKpvYJ<https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ>. >> >> > 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<django-users%2bunsubscr...@googlegroups.com>. >> >> > For more options, visit this group at >> > http://groups.google.com/**group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>. >> >> >> >> > Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto: > >> On 25/06/2012 6:51pm, ledzgio wrote: >> > How can I change default project/app date format to dd-mm-YYYY? >> >> This is straight from the Python 2.7 docs. >> >> >>>import datetime >> >>>d = datetime.datetime(2010, 7, 4, 12, 15, 58) >> >>> '{:%Y-%m-%d%H:%M:%S}'.format(**d) >> '2010-07-04 12:15:58' >> >> or in a template ... >> https://docs.djangoproject.**com/en/dev/ref/templates/**builtins/#date<https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date> >> >> hth >> >> Mike >> >> > >> > thanks >> > -- >> > 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/-/**Z3fcdtqKpvYJ<https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ>. >> >> > 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<django-users%2bunsubscr...@googlegroups.com>. >> >> > For more options, visit this group at >> > http://groups.google.com/**group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>. >> >> >> >> > Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto: > >> On 25/06/2012 6:51pm, ledzgio wrote: >> > How can I change default project/app date format to dd-mm-YYYY? >> >> This is straight from the Python 2.7 docs. >> >> >>>import datetime >> >>>d = datetime.datetime(2010, 7, 4, 12, 15, 58) >> >>> '{:%Y-%m-%d%H:%M:%S}'.format(**d) >> '2010-07-04 12:15:58' >> >> or in a template ... >> https://docs.djangoproject.**com/en/dev/ref/templates/**builtins/#date<https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date> >> >> hth >> >> Mike >> >> > >> > thanks >> > -- >> > 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/-/**Z3fcdtqKpvYJ<https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ>. >> >> > 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<django-users%2bunsubscr...@googlegroups.com>. >> >> > For more options, visit this group at >> > http://groups.google.com/**group/django-users?hl=en<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 view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/oJN-bubQ5v4J. > > 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.