Some models don't use an id field. If a model is based off of
AbstractCA/Cert and specifies a primary_key field that isn't
the default id, Attribute errors will occur in the save method.
Swap self.id for self.pk will still point to id if it's not
specified, but will allow for users to use a different PK field.
In my use case, I want to use the certificate's sha256 fingerprint as the identifier so my urls in my rest API will look like certificate/<fingerprint>.
Some models don't use an id field. If a model is based off of AbstractCA/Cert and specifies a primary_key field that isn't the default
id
, Attribute errors will occur in the save method.Swap
self.id
forself.pk
will still point toid
if it's not specified, but will allow for users to use a different PK field.https://docs.djangoproject.com/en/2.2/ref/models/instances/#django.db.models.Model.pk
In my use case, I want to use the certificate's sha256 fingerprint as the identifier so my urls in my rest API will look like
certificate/<fingerprint>
.