class EncryptedPKModel(models.Model):
    """Adds encrypted_pk property to children."""
encryption = DES.new('8charkey')

def _encrypted_pk(self):
    return struct.unpack('<Q', self.encryption_obj.encrypt(str(struct.pack(
        '<Q', self.pk))))[0]
encrypted_pk = property(_encrypted_pk)


class Meta:
    abstract = True
Creating django objects with a random primary key