On Jul 11, 11:36 am, Lachlan Musicman <[email protected]> wrote:
> On Mon, Jul 11, 2011 at 18:58, stan <[email protected]> wrote:
> > Hi,
>
> > Maybe I missed something, but I didn't found any explanation in the
> > doc about how to localize a date or a number in the python code side.
> > Maybe I am totally wrong about wanting to do that but I can't see a
> > solution to resolve the following problem in the template (where
> > localization should be processed, I agree).
>
> > The typical use case is in the admin_list when you have a method in
> > list_display or MyModel.__unicode__() that return a string with a date
> > or a number. For example :
>
> > from django.utils.formats import localize
>
> > 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 ?


>
> I know I'm not answering the question, apols, but the kids are
> screaming for dinner etc.
>
> L.
>
>
>
>
>
>
>
>
>
> >    price = models.DecimalField(max_digits=8, decimal_places=2)
>
> >    def __unicode__(self):
> >        return u"%s - %s $" % (localize(self.date_published),
> > localize(self.price))
>
> > Is that usage discouraged and the reason for not being documented ?
>
> > If not, do I have to open a ticket with a path for this page :
> >https://docs.djangoproject.com/en/dev/topics/i18n/localization/?
>
> > Best regards.
>
> > --
> > 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 
> > athttp://groups.google.com/group/django-developers?hl=en.
>
> --
> 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.

Reply via email to