Django Mapping strings to strings with HStoreField - a PostgreSQL specific field Adding HStoreField to your model


-> Note: make sure you set up HStoreField first before going on with this example. (above)

No parameters are required for initializing a HStoreField.

from django.contrib.postgres.fields import HStoreField
from django.db import models
class Catalog(models.model):
    name = models.CharField(max_length=200)
    titles_to_authors = HStoreField()