Sunday 15 August 2010

python - django strip/remove/clear value -



python - django strip/remove/clear value -

i using django 1.6.7 & python 2.7.

i trying clear info in field if fits status before value submitted database.

i had been using strip, no longer works. after searching django docs cannot find solution.

here code in forms.py file, strip() not work:

if atype_config.localitydisplay: def clean_address_locality(self): value = self.cleaned_data['address_locality'] homecoming value.strip()

the reply not user strip. utilize pop() instead.

here code:

if not atype_config.localitydisplay: self.cleaned_data.pop('address_locality', none)

i hope helps someone.

python django

No comments:

Post a Comment