Re: run python function in output of annotated query

2016-03-31 Thread Fabio C. Barrionuevo da Luz
no specific reason. This value is later converted to json, and consumed by javascript from Ajax call.. this was the simplest way I thought, without being obliged to rewrite an one ton of code. ( yes it is a lovely project with spaghetti code, which I hope will one day be authorized to rewrite it

Re: run python function in output of annotated query

2016-03-31 Thread Simon Charette
Hi Fábio, Since the deprecation of `SubfieldBase`[1] you must implement a `from_db_value()`[2] method to convert the value as returned by the database to the correct Python object. Out of curiosity, is there a reason you are doing this the model level? It looks like something that belongs to the

run python function in output of annotated query

2016-03-31 Thread Fabio C. Barrionuevo da Luz
Hello django-users, I have a unmanaged model, of legacy database, used only to read. I need to clean the value of a field returned in a annotated query. I try created a new model field inherits from TextField and override to_python method to clean the value (remove all html using python-bleach),