On 02/18/11 09:44, Roman Klesel wrote:
> [..] in some cases the values
> stored in the tables have to be converted before the can be displayed
> and also have to be converted bevore bein saved to the database.
> [...]

>     def clean(self,value):
>         "convert the literal value to the db representation"
> [...]

> On top of that, I feel like working against the ideas of whole validation 
> thing.

I think you may consider it a hack

> Can someone suggest a better solution? Maybe an easier one. Or a more
> stable one? There are quite some fields where I have to do such
> conversions. I'm really trying to find a clean solution which is not
> just tricking the framework.

I would use pre_save signal for data modification

http://docs.djangoproject.com/en/dev/topics/signals/
http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.pre_save

Piotr
-- 
blog  http://piotr.zalewa.info
jobs  http://webdev.zalewa.info
twit  http://twitter.com/zalun
face  http://facebook.com/zaloon

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to