from django.db import models
from django_pgjson.fields import JsonField


class Document(models.Model):
    source = models.CharField(max_length=255)
    docID = models.TextField()

    providerUpdatedDateTime = models.DateTimeField(null=True)

    raw = JsonField()
    normalized = JsonField(null=True)


class HarvesterResponse(models.Model):

    key = models.TextField(primary_key=True)

    method = models.CharField(max_length=8)
    url = models.TextField()

    # Raw request data
    ok = models.NullBooleanField(null=True)
    content = models.BinaryField(null=True)
    encoding = models.TextField(null=True)
    headers_str = models.TextField(null=True)
    status_code = models.IntegerField(null=True)
    time_made = models.DateTimeField(auto_now=True)

@@ -97,16 +97,61 @@
 Model):%0A
+    key = models.TextField(primary_key=True)%0A
     sour
@@ -344,16 +344,299 @@
 =True)%0A%0A
+    def save(self, *args, **kwargs):%0A        if not self.key:%0A            self.key = self._make_key(self.source, self.docID)%0A        return super(Document, self).save(*args, **kwargs)%0A%0A    @classmethod%0A    def _make_key(cls, source, docID):%0A        return '%7C'.join((source, docID))%0A%0A
 %0Aclass H

Update model