Hmm, I'm actually trying this Australian localisation.
However, the weird thing is, there's a US models.py:
http://code.djangoproject.com/browser/django/trunk/django/contrib/localflavor/us/models.py
But there's no such models.py for other countries. E.g., for
Australia:
http://code.djangoproject.com/browser/django/trunk/django/contrib/localflavor/au
Is there a particular reason for this? Or any way of achieving the
same effect?
Cheers,
Victor
On Oct 29, 5:48 am, Frank Wiles <fr...@wiles.org> wrote:
> On Thu, Oct 28, 2010 at 12:23 AM, Victor Hooi <victorh...@gmail.com> wrote:
> > Hi,
>
> > Is there any way to combine the localflavor module (http://
> > docs.djangoproject.com/en/dev/ref/contrib/localflavor/) with Django's
> > in-built admin module?
>
> > For example, I'd like to create a model with say, a Postcode and phone-
> > number field, and have these validated in the admin, as per the rules
> > setup in localflavor?
>
> Hi Victor,
>
> You just need to use the the model fields to achieve this. So for
> example, if I was going to do a US Phone Number field I would do:
>
> from django.db import models
> from django.contrib.localflavor.us.models import PhoneNumberField
>
> class Test(models.Model):
> phone = PhoneNumberField()
>
> You'd obviously need to reference the exact field you're looking for,
> but then it just automagically works in the admin.
>
> --
> Frank Wiles
> Revolution Systems |http://www.revsys.com/
> fr...@revsys.com | (800) 647-6298
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment