On Jul 12, 2:21 am, Lachlan Musicman <[email protected]> wrote: > On Mon, Jul 11, 2011 at 21:02, stan <[email protected]> wrote: > > >> > class Book(models.Model): > >> > title = models.CharField(max_length=120) > >> > date_published = models.DateField() > > >> Big tip - if you *actually* need a date_published field, use a string :) > > > Sorry, but I don't get it. > > > You mean a CharField, right ? > > Yah, sorry. I actually needed to write a "Books" app for some > translation data entry that needed doing at my local Uni - and Char > was plain easier for search and sort than Date - and very few books > have the month/day details - think about what you actually need the > date_published field for: search and sort and that's about it. You do > not need to do any maths with it. Use the Char.
Well, thanks for the advice but that is absolutely not the point. I just want my string containing dates, datetimes, numbers to be localized in the html, whatever the locale is. Books is just a stupid example. Because this is a string that is returned to the template and not a Date or Decimal object, the localization cannot occurs in the template *as far as I know*. I found a solution in digging into the code but the question remains : 1. I that usage a bad usage ; 2. if not 1: we should add a section in the doc, right ? Thanks. > > cheers > L. > > -- > Schweigt stille, plaudert nicht (Be still, stop chattering) (aka The > Coffee Cantata) (BWV 211) is a secular cantatawritten by Johann > Sebastian Bach between 1732 and 1734. In a satirical commentary, the > cantata tells of an addiction to coffee, a pressing social problem in > eighteenth century Leipzig, where this work was premiered. > (viahttp://bestofwikipedia.tumblr.com/) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
