1

I want to store key-value pair in one column.

Above >Django-1.7 provides hstore to do that.

But I want to same functionality in Django-1.7.

How can I create custom datatype to store key-value pair in one column.

I am using postgres-9.5 database.

I want to store below json in key value pair in one column.

Example:

{
    "prepared_date":"2016-08-08T02:04:34Z",
    "date_0":"2016-08-08T02:04:34Z",
    "status_0":true,
    "date_1":"2016-08-08T02:04:34Z",
    "status_1":true,
    "date_2":"2016-08-08T02:04:34Z",
    "status_2":true,
}
Soham Navadiya
  • 403
  • 1
  • 6
  • 18

1 Answers1

4

There's a nice package exactly for this purpose:

http://djangonauts.github.io/django-hstore/

So just install using pip:

pip install django-hstore
Sune Kjærgård
  • 688
  • 6
  • 11