Friday, December 31, 2010

Re: Local flavor and admin (zip-code)

On Dec 2 2008, 1:16 pm, Fabio Natali <nat...@poisson.phc.unipi.it> wrote:
> Dear Sergio, thank you very much for your reply.
>
> sergioh wrote:
>
> [...]
>
> > from django.contrib.localflavor.it.forms import ITZipCodeField
> > from django import forms
> > from django.utils.translation import ugettext_lazy as _
>
> > class DittaDipendentiAdmin(admin.ModelAdmin):
> > cap = ITZipCodeField(_('ZIP Code'))
>
> > class Meta:
> > model= DittaDipendenti
>
> > Just overriding the form field using the ITZipCodeField, works fine.
>
> If I write:
>
> class DittaProva(models.Model):
> cap = models.IntegerField("Cap",max_length=5)
>
> from django.contrib.localflavor.it.forms import ITZipCodeField
> from django import forms
> from django.utils.translation import ugettext_lazy as _
> class DittaProvaAdmin(admin.ModelAdmin):
> cap = ITZipCodeField(_('ZIP Code'))
> class Meta:
> model= DittaProva
>
> then I get this error at the command line:
>
> $ python manage.py syncdb
> [...]
> class DittaProvaAdmin(admin.ModelAdmin):
> File "/home/fabio/my_django/arteak/../arteak/anagrafiche/models.py", line 20, in DittaProvaAdmin
> cap = ITZipCodeField(_('ZIP Code'))
> File "/home/fabio/my_django/django-trunk/django/contrib/localflavor/it/forms.py", line 18, in __init__
> max_length=None, min_length=None, *args, **kwargs)
> TypeError: __init__() got multiple values for keyword argument 'max_length'
>
> Do I miss anything? Any other tips?

I'm quite confused and stuck on this too.
As you, I want to override a model field by a django.contrib.localflavor class.

Let me know if you got any success.

Thanks!
--
Vinicius Massuchetto
http://vinicius.soylocoporti.org.br

--
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