arbitrary typed data in django model

Posted by Dmitry Shevchenko on Stack Overflow See other posts from Stack Overflow or by Dmitry Shevchenko
Published on 2010-04-14T12:50:14Z Indexed on 2010/04/14 12:53 UTC
Read the original article Hit count: 356

Filed under:

I have a model, say, Item. I want to store arbitrary amount of attributes on it, like title, description, release_date. And i want them to be not just strings but have python type, so string, boolean, datetime etc.

What are my options here? EAV pattern with separate name-value table won't work because of the same DB type across all values. JSONField can probably help, but it doesn't know about datetime, for example. Also i was looking at PickeField, it fits perfectly, but i'm a bit concerned about performance.

© Stack Overflow or respective owner

Related posts about django