Skip to content

Blockchain App

Models

DIDRegistration

DIDRegistration(id, did, public_key, registered_at, institution, transaction, trust_updated)

Fields

  • id (BigAutoField) - blank allowed
  • did (CharField)
  • public_key (TextField)
  • registered_at (DateTimeField) - blank allowed
  • institution (ForeignKey)
  • transaction (ForeignKey) - nullable - blank allowed
  • trust_updated (BooleanField)

Methods

  • adelete(self, using=None, keep_parents=False)
  • arefresh_from_db(self, using=None, fields=None, from_queryset=None)
  • asave(self, *args, force_insert=False, force_update=False, using=None, update_fields=None)
  • clean(self)

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

  • clean_fields(self, exclude=None)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

  • date_error_message(self, lookup_type, field_name, unique_for)
  • delete(self, using=None, keep_parents=False)
  • full_clean(self, exclude=None, validate_unique=True, validate_constraints=True)

Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.

  • get_constraints(self)
  • get_deferred_fields(self)

Return a set containing names of deferred fields for this instance.

  • get_next_by_registered_at(self, , field=, is_next=True, *kwargs)
  • get_previous_by_registered_at(self, , field=, is_next=False, *kwargs)
  • prepare_database_save(self, field)
  • refresh_from_db(self, using=None, fields=None, from_queryset=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn't loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

  • save(self, *args, force_insert=False, force_update=False, using=None, update_fields=None)

Save the current instance. Override this in a subclass if you want to control the saving process.

The 'force_insert' and 'force_update' parameters can be used to insist that the "save" must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

  • save_base(self, raw=False, force_insert=False, force_update=False, using=None, update_fields=None)

Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.

The 'raw' argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.

  • serializable_value(self, field_name)

Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there's no Field object with this name on the model, return the model attribute's value.

Used to serialize a field's value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.

  • unique_error_message(self, model_class, unique_check)
  • validate_constraints(self, exclude=None)
  • validate_unique(self, exclude=None)

Check unique constraints on the model and raise ValidationError if any failed.


OnChainTransaction

OnChainTransaction(id, tx_hash, status, transaction_type, metadata, block_number, created_at, updated_at)

Fields

  • id (BigAutoField) - blank allowed
  • tx_hash (CharField)
  • status (CharField)
  • transaction_type (CharField)
  • metadata (JSONField) - blank allowed
  • block_number (PositiveIntegerField) - nullable - blank allowed
  • created_at (DateTimeField) - blank allowed
  • updated_at (DateTimeField) - blank allowed

Methods

  • adelete(self, using=None, keep_parents=False)
  • arefresh_from_db(self, using=None, fields=None, from_queryset=None)
  • asave(self, *args, force_insert=False, force_update=False, using=None, update_fields=None)
  • clean(self)

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

  • clean_fields(self, exclude=None)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

  • date_error_message(self, lookup_type, field_name, unique_for)
  • delete(self, using=None, keep_parents=False)
  • full_clean(self, exclude=None, validate_unique=True, validate_constraints=True)

Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.

  • get_constraints(self)
  • get_deferred_fields(self)

Return a set containing names of deferred fields for this instance.

  • get_next_by_created_at(self, , field=, is_next=True, *kwargs)
  • get_next_by_updated_at(self, , field=, is_next=True, *kwargs)
  • get_previous_by_created_at(self, , field=, is_next=False, *kwargs)
  • get_previous_by_updated_at(self, , field=, is_next=False, *kwargs)
  • get_status_display(self, *, field=)
  • get_transaction_type_display(self, *, field=)
  • prepare_database_save(self, field)
  • refresh_from_db(self, using=None, fields=None, from_queryset=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn't loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

  • save(self, *args, force_insert=False, force_update=False, using=None, update_fields=None)

Save the current instance. Override this in a subclass if you want to control the saving process.

The 'force_insert' and 'force_update' parameters can be used to insist that the "save" must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

  • save_base(self, raw=False, force_insert=False, force_update=False, using=None, update_fields=None)

Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.

The 'raw' argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.

  • serializable_value(self, field_name)

Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there's no Field object with this name on the model, return the model attribute's value.

Used to serialize a field's value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.

  • unique_error_message(self, model_class, unique_check)
  • validate_constraints(self, exclude=None)
  • validate_unique(self, exclude=None)

Check unique constraints on the model and raise ValidationError if any failed.


Views

render

Return an HttpResponse whose content is filled with the result of calling django.template.loader.render_to_string() with the passed arguments.


Management Commands

reset_blockchain

Help: Reset blockchain state and clear contract data

Methods: - add_arguments(self, parser) - handle(self, args, *options)


approve_issuer

Help: Approve an issuer on the blockchain TrustRegistry

Methods: - add_arguments(self, parser) - handle(self, args, *options)


register_all_dids

Help: Register all user DIDs on the blockchain

Methods: - add_arguments(self, parser) - handle(self, args, *options)


debug_blockchain

Help: Debug blockchain connection and contract status

Methods: - add_arguments(self, parser) - handle(self, args, *options)


deploy_contracts

Help: Deploy contracts to Ganache blockchain and update ABIs from Truffle build

Methods: - add_arguments(self, parser) - handle(self, args, *options)


fix_credential_signature

Help: Fix credential signatures by updating holder DID and re-signing

Methods: - add_arguments(self, parser)

Entry point for subclassed commands to add custom arguments.

  • handle(self, args, *options)

quick_fix_blockchain

Help: Quick fix for blockchain state using a funded account

Methods: - add_arguments(self, parser)

Entry point for subclassed commands to add custom arguments.

  • handle(self, args, *options)

create_missing_wallets

Help: Creates wallets for users without them

Methods: - add_arguments(self, parser) - handle(self, args, *options)


list_commands

Help: List all available blockchain management commands

Methods: - add_arguments(self, parser)

Entry point for subclassed commands to add custom arguments.

  • handle(self, args, *options)