api – Rewards Suite API package

Initialization module for Rewards Suite API package.

api.serializers – Rewards Suite API serializers

Module containing Rewards Suite API serializers.

class api.serializers.AggregatedCycleSerializer(*args, **kwargs)[source]

Bases: Serializer

Serializer for aggregated cycle data with contributor rewards summary.

Variables:
  • id – cycle identifier

  • start – cycle start date

  • end – cycle end date

  • contributor_rewards – dictionary mapping contributor addresses to reward amounts

  • total_rewards – total rewards distributed in the cycle

class api.serializers.ContributionSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer for Contribution model.

Variables:
  • id – contribution identifier

  • contributor – contributor who made the contribution

  • cycle – cycle the contribution belongs to

  • platform – social platform where contribution was made

  • reward – reward associated with the contribution

  • percentage – reward percentage for this contribution

  • url – contribution URL

  • comment – optional comment about the contribution

  • confirmed – whether contribution is confirmed

class Meta[source]

Bases: object

fields = ('id', 'contributor', 'cycle', 'platform', 'reward', 'percentage', 'url', 'comment', 'confirmed')
model

alias of Contribution

class api.serializers.ContributorSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer for Contributor model.

Variables:
  • name – contributor’s display name

  • address – contributor’s wallet address

class Meta[source]

Bases: object

fields = ('name', 'address')
model

alias of Contributor

class api.serializers.CycleSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer for Cycle model.

Variables:
  • id – cycle identifier

  • start – cycle start date

  • end – cycle end date

class Meta[source]

Bases: object

fields = ('id', 'start', 'end')
model

alias of Cycle

class api.serializers.HumanizedContributionSerializer(*args, **kwargs)[source]

Bases: Serializer

Serializer for human-readable contribution data with computed fields.

Variables:
  • id – contribution identifier

  • contributor_name – contributor’s display name

  • cycle_id – cycle identifier

  • platform – social platform name

  • url – contribution URL

  • type – contribution type

  • level – contribution level/tier

  • percentage – reward percentage for this contribution

  • reward – calculated reward amount

  • confirmed – whether contribution is confirmed

class api.serializers.IssueSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer for Issue model.

Variables:
  • id – issue identifier

  • number – issue number defined by issue tracker provider

  • status – issue status

class Meta[source]

Bases: object

fields = ('id', 'number', 'status')
model

alias of Issue

class api.serializers.RewardSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer for Reward model.

Variables:
  • type – reward type

  • level – reward level/tier

  • amount – reward amount

  • description – reward description

class Meta[source]

Bases: object

fields = ('type', 'level', 'amount', 'description')
model

alias of Reward

class api.serializers.RewardTypeSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer for RewardType model.

Variables:
  • label – reward type identifier label

  • name – human-readable reward type name

class Meta[source]

Bases: object

fields = ('label', 'name')
model

alias of RewardType

class api.serializers.SocialPlatformSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer for SocialPlatform model.

Variables:
  • name – platform name (e.g., ‘twitter’, ‘discord’)

  • prefix – URL prefix for platform contributions

class Meta[source]

Bases: object

fields = ('name', 'prefix')
model

alias of SocialPlatform

api.urls – Rewards Suite API URL configuration module

Module containing Rewards Suite API URL configuration.

api.views – Rewards Suite API views module

Module containing Rewards Suite API views.

class api.views.AddContributionView(**kwargs)[source]

Bases: LocalhostAPIView

API view to add new contribution.

async post(request)[source]

Handle POST request to create a new contribution.

Parameters:

request (rest_framework.request.Request) – HTTP request object with contribution data

Variables:
  • data – prepared contribution data

  • errors – collection of error messages

Returns:

created contribution data or validation errors

Return type:

rest_framework.response.Response

class api.views.AddIssueView(**kwargs)[source]

Bases: LocalhostAPIView

API view to add new issue and related contribution.

async post(request)[source]

Handle POST request to create a new issue.

Parameters:

request (rest_framework.request.Request) – HTTP request object with issue data

Variables:
  • contribution_data – prepared contribution data

  • data – prepared issue data

  • errors – collection of error messages

Returns:

created issue data or validation errors

Return type:

rest_framework.response.Response

class api.views.ContributionsTailView(**kwargs)[source]

Bases: LocalhostAPIView

API view to retrieve the most recent contributions (tail).

async get(request)[source]

Handle GET request for recent contributions tail.

Parameters:

request (rest_framework.request.Request) – HTTP request object

Returns:

recent contributions data response

Return type:

rest_framework.response.Response

class api.views.ContributionsView(**kwargs)[source]

Bases: LocalhostAPIView

API view to retrieve contributions with optional contributor filtering.

async get(request)[source]

Handle GET request for contributions data.

Parameters:

request (rest_framework.request.Request) – HTTP request object with optional ‘name’ query parameter

Variables:
  • username – contributor’s username

  • contributor – contributor’s model instance

  • queryset – QuerySet of Contribution objects

Returns:

contributions data response

Return type:

rest_framework.response.Response

class api.views.CurrentCycleAggregatedView(**kwargs)[source]

Bases: LocalhostAPIView

API view to retrieve aggregated data for the current cycle.

async get(request)[source]

Handle GET request for current cycle aggregated data.

Parameters:

request (rest_framework.request.Request) – HTTP request object

Returns:

aggregated current cycle data response

Return type:

rest_framework.response.Response

class api.views.CurrentCyclePlainView(**kwargs)[source]

Bases: LocalhostAPIView

API view to retrieve plain cycle data for the current cycle.

async get(request)[source]

Handle GET request for current cycle plain data.

Parameters:

request (rest_framework.request.Request) – HTTP request object

Returns:

plain current cycle data response

Return type:

rest_framework.response.Response

class api.views.CycleAggregatedView(**kwargs)[source]

Bases: LocalhostAPIView

API view to retrieve aggregated data for a specific cycle.

Variables:

cycle_id – URL parameter specifying the cycle identifier

async get(request, cycle_id)[source]

Handle GET request for specific cycle aggregated data.

Parameters:
  • request (rest_framework.request.Request) – HTTP request object

  • cycle_id (int) – cycle identifier from URL

Returns:

aggregated cycle data response

Return type:

rest_framework.response.Response

class api.views.CyclePlainView(**kwargs)[source]

Bases: LocalhostAPIView

API view to retrieve plain cycle data for a specific cycle.

Variables:

cycle_id – URL parameter specifying the cycle identifier

async get(request, cycle_id)[source]

Handle GET request for specific cycle plain data.

Parameters:
  • request (rest_framework.request.Request) – HTTP request object

  • cycle_id (int) – cycle identifier from URL

Returns:

plain cycle data response

Return type:

rest_framework.response.Response

class api.views.IsLocalhostPermission[source]

Bases: BasePermission

Allow access only to requests from localhost.

has_permission(request, view)[source]

Allow only localhost to access API endpoint.

Parameters:

request (rest_framework.request.Request) – HTTP request object

Variables:
  • xff_address – forwarded address

  • remote_addr – address that called the endpoint

Returns:

Boolean

class api.views.LocalhostAPIView(**kwargs)[source]

Bases: APIView

Base APIView that restricts access to localhost by default.

permission_classes = [<class 'api.views.IsLocalhostPermission'>]
async api.views.aggregated_cycle_response(cycle: Cycle)[source]

Generate aggregated cycle response with contributor rewards data.

Parameters:

cycle (core.models.Cycle) – Cycle instance to aggregate data for

Returns:

DRF Response with aggregated cycle data

Return type:

rest_framework.response.Response

async api.views.contributions_response(contributions)[source]

Fetch, humanize, serialize, and return contributions.

Parameters:

contributions (django.db.models.QuerySet) – QuerySet of Contribution objects

Returns:

DRF Response with humanized contributions data

Return type:

rest_framework.response.Response

async api.views.process_contribution(raw_data, confirmed=False)[source]

Process contribution data synchronously in thread pool.

Parameters:
  • raw_data (dict) – raw contribution data from request

  • confirmed (Boolean) – should contribution be created as confirmed or not

Variables:
  • contributor – contributor instance

  • cycle – rewards cycle instance

  • platform – social platform instance

  • label – reward name

  • name – reward label

  • reward_type – reward type instance

  • rewards – queryset of Reward objects

  • data – prepared contribution data

  • serializer – contribution serializer instance

Returns:

tuple of (serialized_data, errors)

Return type:

two-tuple

async api.views.process_issue(raw_data)[source]

Process issue data synchronously in thread pool.

Parameters:

raw_data (dict) – raw issue data from request

Variables:
  • data – prepared issue data

  • serializer – issue serializer instance

Returns:

tuple of (serialized_data, errors)

Return type:

tuple

contract – Rewards Suite smart contract package

Initialization module for contract package.

contract.artifacts – Smart contract artifacts

contract.contract – Smart contract creation module

Rewards Suite smart contract module.

class contract.contract.Allocation(amount: UInt64, expires_at: UInt64)[source]

Bases: Struct

Represents a user’s allocation with amount and expiration.

amount: UInt64
expires_at: UInt64
class contract.contract.Rewards(*args: Any, **kwargs: dict[str, Any])[source]

Bases: ARC4Contract

A rewards smart contract for distributing an ASA (Algorand Standard Asset).

The contract is managed by an admin who can: 1. Fund the contract with the ASA. 2. Register user addresses with specific amounts to be claimed.

Users can: 1. Claim their allocated amount of the ASA.

The admin can also reclaim any remaining funds after a specified claim period ends.

add_allocations(addresses: DynamicArray[Address], amounts: DynamicArray[UIntN[64]]) None[source]

Adds or updates allocations for a batch of users. If a user already has an allocation, the new amount is added to the existing one, and the expiration is reset.

Parameters:
  • addresses – An array of user addresses.

  • amounts – An array of corresponding allocation amounts.

claim() None[source]

Allows a user to claim their allocated tokens. The user must opt-in to the ASA in a separate transaction within the same atomic group as the call to this method. The contract then transfers the allocated ASA amount to the user and removes their allocation to prevent re-claiming.

create_application() None[source]

Handles the application creation. This method is called only once, when the contract is deployed. It sets the sender of the creation transaction as the admin.

delete_application() None[source]

Allows the admin to delete the application.

global_state_types = {}
reclaim_allocation(user_address: Account) None[source]

Allows the admin to reclaim a user’s allocation if it has expired.

Parameters:

user_address – The address of the user whose allocation is to be reclaimed.

setup(token: Asset, claim_period_duration: UInt64) None[source]

Sets up the contract with the token ID and the claim period duration. This method can only be called by the admin and only once. It also makes the contract account opt-in to the specified ASA.

Parameters:
  • token – The ASA to be distributed.

  • claim_period_duration – The duration of the claim period in seconds.

contract.deploy – Module with functions for smart contract deployment

Module with functions for deploying Rewards Suite smart contract to blockchain.

contract.deploy.delete_dapp(network, app_id)[source]

Delete a deployed smart contract application.

Creates an Algod client, retrieves the creator private key from the environment, and calls delete_app() to remove the application from the blockchain.

Parameters:
  • network (str) – The network where the dApp exists (e.g., "testnet").

  • app_id (int) – The application ID to delete.

Variables:
  • env – environment variables collection

  • client – Algorand Node client instance

  • creator_private_key – private key of the creator used to sign deletion

Returns:

None

Return type:

None

contract.deploy.deploy_and_setup(network)[source]

Deploy smart contract on network, fund the app’s escrow, and setup application.

Parameters:

network (str) – network to deploy to (e.g., “testnet”)

Variables:

app_id – Rewards dApp unique identifier

Returns:

int

contract.deploy.deploy_app(network='testnet')[source]

Compile Rewards Suite smart contract, deploy it, and update the artifacts.

This function orchestrates the deployment process by: 1. Compiling the TEAL approval and clear programs 2. Creating a new application on the specified network 3. Capturing the new app ID and the network’s genesis hash 4. Updating the ARC-56 JSON artifact with the new network information

Parameters:

network (str) – network to deploy to (e.g., “testnet”)

Variables:
  • env – environment variables collection

  • dapp_name – name of the smart contract application

  • client – Algorand Node client

  • creator_private_key – private key of the application creator

  • approval_program_source – approval program source code

  • clear_program_source – clear program source code

  • contract_json – ARC-56 smart contract specification

  • approval_program – compiled approval program

  • clear_program – compiled clear program

  • app_id – ID of the newly created application

  • genesis_hash – genesis hash of the network

Returns:

ID of the newly created application

Return type:

int

contract.deploy.setup_app(network)[source]

Set up the deployed smart contract.

Parameters:

network (str) – network to deploy to (e.g., “testnet”)

Variables:
  • env – environment variables collection

  • client – Algorand Node client

  • token_id – Algorand standard asset identifier to be distributed

  • claim_period_duration – duration of the claim period in seconds

  • genesis_hash – genesis hash of the network

  • atc_stub – collection of data required to create atomic transaction

  • atc – clear program source code

  • response – atomic transaction creation response

contract.helpers – Smart contract helper functions module

Module with Rewards smart contract’s helpers functions.

contract.helpers.address_from_box_name(box_name)[source]

Reverse box name back to Algorand address.

Parameters:

box_name (str) – base64 string box name

Variables:
  • prefix – box name’s pstarting part that precedes address

  • decoded – box name decoded from base64

Returns:

str

contract.helpers.app_schemas(contract_json)[source]

Return instances of state schemas for smart contract’s global and local apps.

Parameters:

contract_json (dict) – full path to smart contract’s JSON file

Variables:
  • schema – smart contract’s schema

  • global_schema – smart contract’s global schema

  • local_schema – smart contract’s local schema

  • local_bytes – total number of local bytes states

  • global_ints – total number of global uint states

  • global_bytes – total number of global bytes states

Returns:

two-tuple

contract.helpers.atc_method_stub(client, network)[source]

Return instances needed for calling a method with AtomicTransactionComposer.

Parameters:
  • client (AlgodClient) – Algorand Node client instance.

  • network (str) – The network to connect to (e.g., “testnet”).

Variables:
  • env – Environment variables.

  • admin_private_key – private key of the application admin

  • sender – The address of the transaction sender.

  • signer – The transaction signer.

  • dapp_name – name of the smart contract application

  • contract_json – The ARC-56 smart contract specification.

  • contract – Algorand ABI contract instance

  • sp – suggested transaction params

  • app_id – Rewards dApp unique identifier

Returns:

A dictionary with sender, signer, and contract.

Return type:

dict

contract.helpers.box_name_from_address(address)[source]

Return Rewards dApp box name for provided address.

Parameters:

address (str) – account’s public address

Returns:

bytes

contract.helpers.compile_program(client, source_code)[source]

Collect and return collection of addresses and related values.

Parameters:

client (AlgodClient) – Algorand Node client instance

Variables:
  • source_code – approval/clear program code

  • compile_response – compilation response from Node instance

Returns:

str

contract.helpers.environment_variables()[source]

Return collection of required environment variables.

Returns:

dict

contract.helpers.is_admin_account_configured(network='testnet')[source]

Return True if admin account can make calls to Rewards dApp.

Parameters:

network (str) – The network where the dApp exists (e.g., "testnet").

Variables:
  • env – environment variables collection

  • creator_private_key – private key of the creator used to sign deletion

  • admin_address – admin account public address

  • client – Algorand Node client instance

  • sp – suggested transaction params

  • dapp_name – name of the smart contract application

  • contract_json – The ARC-56 smart contract specification.

  • app_id – Rewards dApp unique identifier

  • app_info – dApp application information

Returns:

Boolean

contract.helpers.pause(seconds=1)[source]

Sleep for provided number of seconds.

Parameters:

seconds (int) – number of seconds to pause

contract.helpers.private_key_from_mnemonic(passphrase)[source]

Return base64 encoded private key created from provided mnemonic passphrase.

Parameters:

passphrase (str) – collection of English words separated by spaces

Returns:

str

contract.helpers.read_json(filename)[source]

Return collection of key and values created from provided filename JSON file.

Parameters:

filename (pathlib.Path) – full path to JSON file

Returns:

dict

contract.helpers.wait_for_confirmation(client, txid)[source]

Wait for a blockchain transaction to be confirmed.

Polls Algorand node until the transaction referenced by txid is confirmed in a round. Prints waiting messages until confirmation then returns full pending transaction information.

Parameters:
  • client (AlgodClient) – Algorand Node client instance

  • txid (str) – blockchain transaction ID

Returns:

pending transaction info including confirmed round

Return type:

dict

contract.network – Module for functions to communicate with blockchain

Module with functions for retrieving and saving blockchain data.

contract.network.app_id_from_contract(env=None, client=None, network='testnet')[source]

Return Rewards application identifier from contract artifact.

Parameters:
  • env (dict) – environment variables collection

  • client (AlgodClient) – Algorand Node client instance

  • network (str) – network to deploy to (e.g., “testnet”)

Variables:

atc_stub – collection of data required to create atomic transaction

Returns:

Rewards dApp unique identifier

Return type:

int

contract.network.claimable_amount_for_address(user_address, network='testnet')[source]

Check if the provided address can claim their allocation.

Parameters:
  • user_address (str) – The address of the user to check for claimability

  • network (str) – network to deploy to (e.g., “testnet”)

Variables:
  • env – environment variables collection

  • client – Algorand Node client instance

  • app_id – Rewards dApp unique identifier

  • box_name – user’s box name

  • value – user’s box value

  • amount – amount to reclaim

  • expires_at – timestamp when user’s claim period ends

Returns:

True if the user can claim, False otherwise

Return type:

bool

contract.network.create_app(client, private_key, approval_program, clear_program, contract_json)[source]

Create a new smart contract application on the Algorand blockchain.

Builds and submits an ApplicationCreate transaction using compiled approval and clear programs. Waits for confirmation and returns the resulting app-id and genesis hash.

Parameters:
  • client (AlgodClient) – Algorand Node client instance.

  • private_key (str) – Creator’s private key used to sign the transaction.

  • approval_program (bytes) – Compiled TEAL approval program.

  • clear_program (bytes) – Compiled TEAL clear program.

  • contract_json (dict) – ARC-56 smart contract specification.

Returns:

A tuple containing the newly created application ID and genesis hash.

Return type:

tuple[int, str]

contract.network.delete_app(client, private_key, app_id)[source]

Delete an existing application on the Algorand blockchain.

Builds and submits an ApplicationDelete transaction, waits for confirmation, and prints application id removed from the blockchain.

Parameters:
  • client (AlgodClient) – Algorand Node client instance

  • private_key (str) – application’s creator private key used to sign transaction

  • app_id (int) – application identifier

contract.network.fund_app(app_id, network, amount=None)[source]

Fund the application escrow account with 0.2 Algo.

Creates an Algod client and sends a payment transaction from the creator’s account to the application escrow address. Waits for confirmation before returning.

Parameters:
  • app_id (int) – The smart contract application ID.

  • network (str) – Network where the app is deployed (e.g., "testnet").

Variables:
  • amount – amount in microAlgos to send to application’s escrow

  • env – environment variables collection

  • client – Algorand Node client instance

  • creator_private_key – The private key of the application creator

  • sender – Derived Algorand wallet address from private key

  • app_address – Application escrow account address

  • sp – suggested transaction params

  • txn – payment transaction params

  • signed_txn – signed transaction instance

  • tx_id – transaction’s unique identifier

contract.network.process_allocations(network, addresses, amounts)[source]

Process allocations after performing a couple of checks.

Parameters:
  • network (str) – network to deploy to (e.g., “testnet”)

  • addresses (list) – list of user addresses

  • amounts (list) – list of corresponding allocation amounts

Variables:
  • env – environment variables collection

  • client – Algorand Node client instance

  • token_id – Algorand standard asset identifier to be distributed

  • atc_stub – collection of data required to create atomic transaction

  • admin_address – Rewards Suite smart contract admin address

  • app_address – Rewards Suite smart contract address

  • app_id – Rewards dApp unique identifier

  • dapp_minimum_algo – minimum required ALGO for dApp

  • app_algo_balance – dApp’s ALGO balance

  • admin_algo_balance – admin’s ALGO balance

  • admin_token_balance – admin’s token balance

contract.network.process_allocations_for_contributions(contributions, allocations_callback)[source]

Process allocations for applicable contributors from contributions.

Parameters:
  • contributions (core.models.Contribution) – collection of contributions connected to closed issue

  • allocations_callback (object) – callback function to retrieve addresses and amounts

Variables:
  • addresses – list of contributor addresses

  • amounts – list of corresponding allocation amounts

  • batch_addresses – curent batch of contributor addresses

  • batch_amounts – curent batch of corresponding allocation amounts

Yield:

two-tuple

contract.network.process_reclaim_allocation(user_address, network='testnet')[source]

Process reclaim allocation after performing a couple of checks.

Parameters:
  • user_address (str) – The address of the user whose allocation is to be reclaimed

  • network (str) – network to deploy to (e.g., “testnet”)

Variables:
  • env – environment variables collection

  • client – Algorand Node client instance

  • app_id – Rewards dApp unique identifier

  • box_name – user’s box name

  • value – user’s box value

  • amount – amount to reclaim

  • expires_at – timestamp when user’s claim period ends

contract.network.reclaimable_addresses(network='testnet')[source]

Return collection of addresses that can be reclaimed.

Parameters:

network (str) – network to deploy to (e.g., “testnet”)

Variables:
  • env – environment variables collection

  • client – Algorand Node client instance

  • app_id – Rewards dApp unique identifier

  • reclaimable_addresses – collection of addresses that can be reclaimed

  • boxes – collection of user’s boxes

  • box – user’s box

  • box_name – user’s box name

  • user_address – user’s public address

  • value – user’s box value

  • amount – amount to reclaim

  • expires_at – timestamp when user’s claim period ends

Returns:

collection of addresses that can be reclaimed

Return type:

list

contract.tests – Smart contract unit-tests package

Initialization module for Algorand smart contract unit tests.

core – Main application package

Initialization module for core application.

core.admin – Main application administration module

Module containing website’s admin UI setup.

class core.admin.SuperuserLogAdmin(model, admin_site)[source]

Bases: ModelAdmin

Customized superusers’ log table in Django admin UI.

has_add_permission(request)[source]

Prevent adding log entries

has_change_permission(request, obj=None)[source]

Prevent modifications to log entries

list_display = ['profile', 'action', 'created_at']
list_filter = ['action', 'created_at', 'profile']
property media
readonly_fields = ['profile', 'action', 'details', 'created_at']
search_fields = ['profile_user__username', 'action', 'details']

core.apps – Main application configuration module

Module containing core app configuration.

class core.apps.CoreConfig(app_name, app_module)[source]

Bases: AppConfig

Main class for core application.

Variables:

CoreConfig.name – app name

default_auto_field = 'django.db.models.BigAutoField'
name = 'core'
ready()[source]

Run this import when Django starts.

core.forms – Module with main application’s forms

Module containing code dealing with core app’s forms.

class core.forms.ContributionCreateForm(*args, **kwargs)[source]

Bases: ModelForm

Model form class for adding new contribution.

Variables:
  • ContributionCreateForm.contributor – contribution’s contributor instance

  • ContributionCreateForm.cycle – contribution’s cycle instance

  • ContributionCreateForm.platform – contribution’s social platform instance

  • ContributionCreateForm.reward – reward type for the contribution

  • ContributionCreateForm.percentage – percentage value for the contribution

  • ContributionCreateForm.comment – optional comment for the contribution

  • ContributionCreateForm.issue_number – tracker issue number

  • ContributionCreateForm.issue_status – Status for newly created issue

class Meta[source]

Bases: object

fields = ['contributor', 'cycle', 'platform', 'reward', 'percentage', 'comment']
model

alias of Contribution

base_fields = {'comment': <django.forms.fields.CharField object>, 'contributor': <django.forms.models.ModelChoiceField object>, 'cycle': <django.forms.models.ModelChoiceField object>, 'issue_number': <django.forms.fields.IntegerField object>, 'issue_status': <django.forms.fields.ChoiceField object>, 'percentage': <django.forms.fields.DecimalField object>, 'platform': <django.forms.models.ModelChoiceField object>, 'reward': <django.forms.models.ModelChoiceField object>}
declared_fields = {'comment': <django.forms.fields.CharField object>, 'contributor': <django.forms.models.ModelChoiceField object>, 'cycle': <django.forms.models.ModelChoiceField object>, 'issue_number': <django.forms.fields.IntegerField object>, 'issue_status': <django.forms.fields.ChoiceField object>, 'percentage': <django.forms.fields.DecimalField object>, 'platform': <django.forms.models.ModelChoiceField object>, 'reward': <django.forms.models.ModelChoiceField object>}
property media

Return all media required to render the widgets on this form.

class core.forms.ContributionEditForm(*args, **kwargs)[source]

Bases: ModelForm

Model form class for editing contribution data.

Variables:
  • ContributionEditForm.reward – reward type for the contribution

  • ContributionEditForm.percentage – percentage value for the contribution

  • ContributionEditForm.comment – optional comment for the contribution

  • ContributionEditForm.issue_number – tracker issue number

  • ContributionEditForm.issue_status – Status for newly created issue

class Meta[source]

Bases: object

fields = ['reward', 'percentage', 'comment']
model

alias of Contribution

base_fields = {'comment': <django.forms.fields.CharField object>, 'issue_number': <django.forms.fields.IntegerField object>, 'issue_status': <django.forms.fields.ChoiceField object>, 'percentage': <django.forms.fields.DecimalField object>, 'reward': <django.forms.models.ModelChoiceField object>}
declared_fields = {'comment': <django.forms.fields.CharField object>, 'issue_number': <django.forms.fields.IntegerField object>, 'issue_status': <django.forms.fields.ChoiceField object>, 'percentage': <django.forms.fields.DecimalField object>, 'reward': <django.forms.models.ModelChoiceField object>}
property media

Return all media required to render the widgets on this form.

class core.forms.ContributionInvalidateForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

Model form class for setting contribution as already existing.

Variables:

ContributionInvalidateForm.reply – optional comment to add as a reply

class Meta[source]

Bases: object

fields = ['reply']
model

alias of Contribution

base_fields = {'reply': <django.forms.fields.CharField object>}
declared_fields = {'reply': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

class core.forms.CreateIssueForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]

Bases: Form

Form class for creating tracker issues.

Variables:
  • CreateIssueForm.labels – issue labels selection

  • CreateIssueForm.priority – issue priority level

  • CreateIssueForm.issue_title – title of the issue

  • CreateIssueForm.issue_body – body content of the issue

base_fields = {'issue_body': <django.forms.fields.CharField object>, 'issue_title': <django.forms.fields.CharField object>, 'labels': <django.forms.fields.MultipleChoiceField object>, 'priority': <django.forms.fields.ChoiceField object>}
clean_labels()[source]

Ensure at least one label is selected.

Raise ValidationError if no labels are selected.

Variables:

data – collection of form data

Returns:

dict

declared_fields = {'issue_body': <django.forms.fields.CharField object>, 'issue_title': <django.forms.fields.CharField object>, 'labels': <django.forms.fields.MultipleChoiceField object>, 'priority': <django.forms.fields.ChoiceField object>}
property media

Return all media required to render the widgets on this form.

class core.forms.CustomSignupForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]

Bases: Form

Form class for confirming agreement with the Terms of Use.

Variables:

CustomSignupForm.terms – Terms of Use agreement Boolean field

base_fields = {'terms': <django.forms.fields.BooleanField object>}
declared_fields = {'terms': <django.forms.fields.BooleanField object>}
property media

Return all media required to render the widgets on this form.

signup(request, user)[source]

A custom signup form must offer this method.

class core.forms.DeactivateProfileForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]

Bases: Form

Form class for deactivating current user.

Only requirement is to correctly populate captcha field. User object is taken from the request object.

Variables:

captcha – field holding value that is going to be compared with captcha

base_fields = {'captcha': <captcha.fields.CaptchaField object>}
deactivate_profile(request)[source]

Logout and deactivate given request’s user in database.

Parameters:

request (HttpRequest) – http request

declared_fields = {'captcha': <captcha.fields.CaptchaField object>}
property media

Return all media required to render the widgets on this form.

class core.forms.IssueLabelsForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]

Bases: Form

Form for adding labels and priority to tracker issues.

Variables:
  • IssueLabelsForm.labels – issue labels selection

  • IssueLabelsForm.priority – issue priority level

base_fields = {'labels': <django.forms.fields.MultipleChoiceField object>, 'priority': <django.forms.fields.ChoiceField object>}
clean_labels()[source]

Ensure at least one label is selected.

Raise ValidationError if no labels are selected.

Variables:

data – collection of form data

Returns:

dict

declared_fields = {'labels': <django.forms.fields.MultipleChoiceField object>, 'priority': <django.forms.fields.ChoiceField object>}
property media

Return all media required to render the widgets on this form.

class core.forms.ProfileForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

Form class for editing user profile’s data.

Variables:

ProfileForm.issue_tracker_api_token – user’s personal issue tracker access token

class Meta[source]

Bases: object

exclude = ['user']
fields = ['issue_tracker_api_token']
model

alias of Profile

base_fields = {'issue_tracker_api_token': <django.forms.fields.CharField object>}
declared_fields = {'issue_tracker_api_token': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

class core.forms.ProfileFormSet(data=None, files=None, instance=None, save_as_new=False, prefix=None, queryset=None, **kwargs)

Bases: BaseInlineFormSet

Formset for editing profile’s data. It is instantiated together with UpdateUserForm form instance in the common user/profile editing process.

absolute_max = 1001
can_delete = False
can_delete_extra = True
can_order = False
edit_only = False
extra = 1
fk = <django.db.models.fields.related.OneToOneField: user>
form

alias of ProfileForm

max_num = 1
min_num = 0
model

alias of Profile

renderer = None
validate_max = False
validate_min = False
class core.forms.TransparencyReportForm(*args, **kwargs)[source]

Bases: Form

Form class for creating transparency report.

Variables:
  • TransparencyReportForm.report_type – report type selection

  • TransparencyReportForm.month – month selection

  • TransparencyReportForm.quarter – quarter selection

  • TransparencyReportForm.year – year selection

  • TransparencyReportForm.start_date – start date selection

  • TransparencyReportForm.end_date – end date selection

  • TransparencyReportForm.ordering – ordering selection

base_fields = {'end_date': <django.forms.fields.CharField object>, 'month': <django.forms.fields.ChoiceField object>, 'ordering': <django.forms.fields.ChoiceField object>, 'quarter': <django.forms.fields.ChoiceField object>, 'report_type': <django.forms.fields.ChoiceField object>, 'start_date': <django.forms.fields.CharField object>, 'year': <django.forms.fields.ChoiceField object>}
clean()[source]

Clean the form data by ensuring fields are present based on report type.

Returns:

cleaned data

Return type:

dict

declared_fields = {'end_date': <django.forms.fields.CharField object>, 'month': <django.forms.fields.ChoiceField object>, 'ordering': <django.forms.fields.ChoiceField object>, 'quarter': <django.forms.fields.ChoiceField object>, 'report_type': <django.forms.fields.ChoiceField object>, 'start_date': <django.forms.fields.CharField object>, 'year': <django.forms.fields.ChoiceField object>}
property media

Return all media required to render the widgets on this form.

class core.forms.UpdateUserForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

Model form class for editing user’s data.

Variables:
  • UpdateUserForm.first_name – user’s first name field

  • UpdateUserForm.last_name – user’s last name field

class Meta[source]

Bases: object

fields = ['first_name', 'last_name']
model

alias of User

base_fields = {'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>}
declared_fields = {'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

core.models – Main application ORM module

Module containing website’s ORM models.

class core.models.Contribution(*args, **kwargs)[source]

Bases: Model

Community member contributions data model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

comment

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

confirmed

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

contributor

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

contributor_id
created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cycle

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

cycle_id
get_absolute_url()[source]

Returns the URL to access a detail record for this contribution.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

info()[source]

Return basic information for this contribution.

Variables:

main_text – starting text

Returns:

str

issue

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

issue_id
objects = <core.models.ContributionManager object>
percentage

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

platform

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

platform_id
reply

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

reward

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

reward_id
updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class core.models.ContributionManager(*args, **kwargs)[source]

Bases: Manager

Custom manager for the Contribution model.

addressed_contributions_addresses_and_amounts()[source]

Create collection of addressed contributions to be added to smart contract.

Variables:

contributions – all contributions for the user defined by provided address

Returns:

two-tuple

addresses_and_amounts_from_contributions(contributions)[source]

Create collection of addresses and related amounts from contributions.

Parameters:

contributions (django.db.models.query.QuerySet) – all contributions for the user defined by provided address

Variables:
  • amounts – collection of addresses and related contribution amounts

  • contrib – collection of addresses and related contribution amounts

Returns:

two-tuple

assign_issue(issue_id, contribution_id)[source]

Assign issue issue_id to the contribution defined by contribution_id.

Parameters:
  • issue_id (int) – issue object’s identifier

  • contribution_id (int) – contribution object’s identifier

Variables:
  • issue – target issue instance

  • contribution – contribution to assign to the issue

update_issue_statuses_for_addresses(addresses, contributions)[source]

Create collection of addresses and related amounts from contributions.

Parameters:
  • addresses (list) – colection of addresses to update issue statuses for

  • contributions (django.db.models.query.QuerySet) – contributions to locate issues from by addresses

Variables:

contrib – colection of addresses and related contribution ammounts

user_has_claimed(address)[source]

Update status of related issues to ARCHIVED for all contributions.

Parameters:

address (str) – public Algorand address

Variables:
  • contributions – all contributions for the user defined by provided address

  • issue_ids – collection of contributor’s contribution IDs

class core.models.Contributor(*args, **kwargs)[source]

Bases: Model

Rewards Suite contributor’s data model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

address

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

addressed_contributions

Return all contributions with issue status ADDRESSED.

Returns:

list of Contribution objects

Return type:

list

archived_contributions

Return all contributions with issue status ARCHIVED.

Returns:

list of Contribution objects

Return type:

list

claimable_contributions

Return all contributions with issue status CLAIMABLE.

Returns:

list of Contribution objects

Return type:

list

contribution_groups

Return collection of all contribution groups with totals for this instance.

Returns:

list of contribution group dictionaries

Return type:

list

contribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_absolute_url()[source]

Returns the URL to access a detail record for this contributor.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
handle_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property info

Return contributor information including handles.

Returns:

contributor information string

Return type:

str

invalidated_contributions

Return all contributions with issue status WONTFIX.

Returns:

list of Contribution objects

Return type:

list

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <core.models.ContributorManager object>
open_contributions

Return all contributions with issue status CREATED.

Returns:

list of Contribution objects

Return type:

list

optimized_contribution_data

Fetch all contribution data in one query and organize it.

This method performs a single database query to fetch all contributions with their related objects (cycle, reward, reward type, and issue), then categorizes them in memory to avoid multiple database hits.

Returns:

dict containing organized contribution data

Return type:

dict

profile

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

sorted_handles

Return handles sorted case-insensitively, using prefetched data if available.

Returns:

sorted list of handles

Return type:

list

total_rewards

Return sum of all reward amounts for this contributor (cached). Excludes contributions with WONTFIX issue status.

Returns:

total reward amount

Return type:

int

uncategorized_contributions

Return all contributions without any issue.

Returns:

list of Contribution objects

Return type:

list

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class core.models.ContributorManager(*args, **kwargs)[source]

Bases: Manager

Rewards Suite contributor’s data manager.

from_full_handle(full_handle, address=None)[source]

Return contributor model instance created from provided full_handle.

Parameters:
  • full_handle (str) – contributor’s unique identifier (platform prefix and handle)

  • address (str) – public Algorand address

Variables:
  • prefix – unique social platform’s prefix

  • handle – contributor’s handle/username

  • platform – social platform’s model instance

  • contributor – contributor’s model instance

Returns:

Handle

from_handle(handle)[source]

Return handle model instance located by provided handle.

Parameters:

handle (str) – contributor’s handle

Variables:
  • handles – handle instances collection

  • count – total number of located contributors

Returns:

Contributor

class core.models.Cycle(*args, **kwargs)[source]

Bases: Model

Rewards Suite periodic rewards cycle data model..

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

contribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property contributor_rewards

Return collection of all contributors and related rewards for cycle (cached).

Variables:

result – collection of contributors and related total reward amounts

Returns:

dict

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_absolute_url()[source]

Returns the URL to access a detail record for this cycle.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_start(*, field=<django.db.models.fields.DateField: start>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_start(*, field=<django.db.models.fields.DateField: start>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

info()[source]

Return extended string representation of the cycle instance

Returns:

str

objects = <django.db.models.manager.Manager object>
start

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property total_rewards

Return sum of all reward amounts for this contributor (cached). Excludes contributions with WONTFIX issue status.

Returns:

int

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class core.models.Handle(*args, **kwargs)[source]

Bases: Model

Rewards Suite social media handle data model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

contributor

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

contributor_id
created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
handle

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <core.models.HandleManager object>
platform

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

platform_id
updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class core.models.HandleManager(*args, **kwargs)[source]

Bases: Manager

Rewards Suite social media handle data manager.

from_address_and_full_handle(address, full_handle)[source]

Return handle model instance derived from provided address and full_handle.

Parameters:
  • address (str) – public Algorand address

  • full_handle (str) – contributor’s unique identifier (platform prefix and handle)

Variables:
  • prefix – unique social platform’s prefix

  • handle – contributor’s handle/username

  • contributor – contributor’s model instance

  • platform – social platform’s model instance

Returns:

Handle

class core.models.Issue(*args, **kwargs)[source]

Bases: Model

Rewards Suite tracker issue model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

contribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_absolute_url()[source]

Returns the URL to access a detail record for this issue.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
get_status_display(*, field=<django.db.models.fields.CharField: status>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property info

Return issue information including contributions.

Returns:

issue information string

Return type:

str

number

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <core.models.IssueManager object>
sorted_contributions

Return contributions sorted by date, using prefetched data if available.

Returns:

sorted list of contributions

Return type:

list

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class core.models.IssueManager(*args, **kwargs)[source]

Bases: Manager

Rewards Suite issues data manager.

confirm_contribution_with_issue(issue_number, contribution)[source]

Create issue from provided number and assign it to confirmed contribution.

Parameters:
  • issue_number (int) – unique tracker issue number

  • contribution (Contribution) – contribution’s model instance

Variables:

issue – issue’s model instance

Returns:

Issue

class core.models.IssueStatus(*values)[source]

Bases: TextChoices

Rewards Suite tracker issue status choices.

ADDRESSED = 'addressed'
ARCHIVED = 'archived'
CLAIMABLE = 'claimable'
CREATED = 'created'
WONTFIX = 'wontfix'
class core.models.Profile(*args, **kwargs)[source]

Bases: Model

App’s connection to main Django user model and optionally to Contributor.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

contributor

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

contributor_id
get_absolute_url()[source]

Return url of the profile home page.

Returns:

url

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

issue_tracker_api_token

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

log_action(action, details='')[source]

Create superuser log action record for this profile from provided arguments.

Parameters:
  • action (str) – action identifier

  • details (str) – detailed data of the action

Returns:

SuperuserLog

property name

Return user/profile name made depending on data fields availability.

Returns:

str

objects = <django.db.models.manager.Manager object>
profile()[source]

Return self instance for generic templating purposes.

It is accessed by ‘object.profile’ in some templates.

Returns:

Profile

superuserlog_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

user

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

user_id
class core.models.Reward(*args, **kwargs)[source]

Bases: Model

Rewards Suite reward data model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

amount

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

contribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

general_description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

level

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
type

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

type_id
updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class core.models.RewardType(*args, **kwargs)[source]

Bases: Model

Rewards Suite reward type data model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
reward_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class core.models.SocialPlatform(*args, **kwargs)[source]

Bases: Model

Rewards Suite social media platform’s data model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

contribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

handle_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
prefix

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class core.models.SuperuserLog(*args, **kwargs)[source]

Bases: Model

Rewards Suite website superusers’ action logs model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

action

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

details

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
profile

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

profile_id

core.signals – Module with main application’s database signals and triggers

Module containing core app signals.

core.signals.create_user_profile(sender, instance, created, **kwargs)[source]

Create profile instance if user is successfully created.

Method is called by signal sent from django infrastructure after sender instance is saved.

Parameters:
  • sender (type) – class responsible for signal sending

  • instance (User) – instance of the sender class

  • created (boolean) – value that determines is sender is created or not

core.signals.save_user_profile(sender, instance, **kwargs)[source]

Update profile instance after related user is updated.

Method is called by signal sent from django infrastructure after sender instance is updated.

Parameters:
  • sender (User) – class responsible for signal sending

  • instance (object of User) – instance of the sender class

core.urls – Main application URL configuration module

Module containing website’s URL configuration.

core.views – Main application views (controllers)

Module containing website’s views.

class core.views.ContributionCreateView(**kwargs)[source]

Bases: CreateView

View for adding contributions (superusers only).

Variables:
  • model – Model class for contributions

  • form_class – Form class for editing contributions

  • template_name – HTML template for the edit form

dispatch(request, *args, **kwargs)[source]

Check if an issue_number was supplied in the URL.

form_class

alias of ContributionCreateForm

form_valid(form)[source]

Save a new contribution and attach issue if pre-set Issue context exists.

get_form(form_class=None)[source]

Filters contributors by serch query inputed by the user.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_success_url()[source]

Redirect to Issue detail if this contribution was added from an issue context, otherwise go to the contribution detail.

model

alias of Contribution

template_name = 'core/contribution_create.html'
class core.views.ContributionDetailView(**kwargs)[source]

Bases: DetailView

View for displaying detailed information about a single contribution.

Variables:

model – Model class for contributions

model

alias of Contribution

class core.views.ContributionEditView(**kwargs)[source]

Bases: UpdateView

View for updating contribution information (superusers only).

Allows superusers to edit contribution details including reward, percentage, comments, tracker issue number, and issue status.

Variables:
  • model – Model class for contributions

  • form_class – Form class for editing contributions

  • template_name – HTML template for the edit form

dispatch(request, *args, **kwargs)
form_class

alias of ContributionEditForm

form_valid(form)[source]

Handle form validation with tracker issue processing.

get_success_url()[source]

Return URL to redirect after successful update.

Returns:

URL for contribution detail page with success message

Return type:

str

model

alias of Contribution

template_name = 'core/contribution_edit.html'
class core.views.ContributionInvalidateView(**kwargs)[source]

Bases: UpdateView

View for setting contribution as duplicate or wontfix.

dispatch(request, *args, **kwargs)
form_class

alias of ContributionInvalidateForm

form_valid(form)[source]

Set contribution as confirmed with reaction and optional reply.

get_context_data(*args, **kwargs)[source]

Add original Discord message text to template context.

get_success_url()[source]

Return URL to redirect after successful update.

model

alias of Contribution

template_name = 'core/contribution_invalidate.html'
class core.views.ContributorDetailView(**kwargs)[source]

Bases: DetailView

View for displaying detailed information about a single contributor.

Variables:

model – Model class for contributors

get_queryset()[source]

Prefetch all related data to avoid N+1 queries.

Returns:

QuerySet of this cycle’s contributions ordered by ID in reverse

Return type:

django.db.models.QuerySet

model

alias of Contributor

class core.views.ContributorListView(**kwargs)[source]

Bases: ListView

View for displaying a paginated list of all contributors.

Variables:
  • model – Model class for contributors

  • paginate_by – Number of items per page

get_context_data(*args, **kwargs)[source]

Add search query to template context.

Parameters:

kwargs – Additional keyword arguments

Returns:

Context dictionary with search data

Return type:

dict

get_queryset()[source]

Return filtered queryset based on search query.

Returns:

QuerySet of contributors filtered by search term

Return type:

django.db.models.QuerySet

model

alias of Contributor

paginate_by = 20
render_to_response(context, **response_kwargs)[source]

Return full template or partial based on instance request.

Parameters:

context (dict) – template context data

Returns:

django.http.HttpResponse

class core.views.CreateIssueView(**kwargs)[source]

Bases: FormView

View for creating tracker issues from contributions.

This view allows superusers to create tracker issues based on contribution data. It pre-populates the form with data from the contribution and handles the tracker API integration for issue creation.

Variables:
  • template_name – HTML template for the create issue form

  • form_class – Form class for creating tracker issues

  • contribution_id – ID of the contribution being processed

dispatch(request, *args, **kwargs)
form_class

alias of CreateIssueForm

form_valid(form)[source]

Process valid form data and create tracker issue.

Parameters:

form (core.forms.CreateIssueForm) – Validated form instance

Returns:

django.http.HttpResponseRedirect

get(request, *args, **kwargs)[source]

Handle GET request for the create issue form.

Parameters:
  • request (django.http.HttpRequest) – HTTP request object

  • args – Additional positional arguments

  • kwargs – Additional keyword arguments including contribution_id

Returns:

django.http.HttpResponse

get_context_data(*args, **kwargs)[source]

Add contribution context data to template.

Parameters:

kwargs – Additional keyword arguments

Returns:

dict

get_initial()[source]

Set initial form data from contribution.

Returns:

dict

get_success_url()[source]

Return URL to redirect after successful form submission.

Returns:

str

post(request, *args, **kwargs)[source]

Handle POST request for form submission.

Parameters:
  • request (django.http.HttpRequest) – HTTP request object

  • args – Additional positional arguments

  • kwargs – Additional keyword arguments including contribution_id

Returns:

django.http.HttpResponse

template_name = 'create_issue.html'
class core.views.CycleDetailView(**kwargs)[source]

Bases: DetailView

View for displaying detailed information about a single cycle.

Variables:

model – Model class for cycles

get_queryset()[source]

Optimize queryset with annotations to avoid additional queries.

Returns:

QuerySet of this cycle’s contributions ordered by ID in reverse

Return type:

django.db.models.QuerySet

model

alias of Cycle

class core.views.CycleListView(**kwargs)[source]

Bases: ListView

View for displaying a paginated list of all cycles in reverse order.

Variables:
  • model – Model class for cycles

  • paginate_by – Number of items per page

get_context_data(*args, **kwargs)[source]

Add total cycles count context data to template.

Parameters:

kwargs – Additional keyword arguments

Returns:

dict

get_queryset()[source]

Return prefetch data of all cycles in reverse chronological order.

Annotate with counts and totals to avoid any additional queries

Returns:

QuerySet of cycles in reverse order

Return type:

django.db.models.QuerySet

model

alias of Cycle

paginate_by = 10
class core.views.DeactivateProfileView(**kwargs)[source]

Bases: FormView

Deactivates current user.

Current user is logged out and deacrtivated after the form is submitted and successful captcha is entered. User is redirected to django-allauth inactive account page afterward.

dispatch(request, *args, **kwargs)
form_class

alias of DeactivateProfileForm

form_valid(form)[source]

If user has correctly entered captcha value then form’s deactivate_profile method is called with current request object as argument.

success_url = '/accounts/inactive/'
template_name = 'deactivate_profile.html'
class core.views.IndexView(**kwargs)[source]

Bases: ListView

View for displaying the main index page with contribution statistics.

Displays a paginated list of unconfirmed contributions along with overall platform statistics.

Variables:
  • model – Model class for contributions

  • paginate_by – Number of items per page

  • template_name – HTML template for the index page

get_context_data(*args, **kwargs)[source]

Update context with the database records count.

Parameters:
  • args – Additional positional arguments

  • kwargs – Additional keyword arguments

Returns:

Context dictionary with statistics data

Return type:

dict

get_queryset()[source]

Return queryset of unconfirmed contributions in reverse order.

Returns:

QuerySet of unconfirmed contributions

Return type:

django.db.models.QuerySet

model

alias of Contribution

paginate_by = 20
template_name = 'index.html'
class core.views.IssueDetailView(**kwargs)[source]

Bases: DetailView

View for displaying detailed information about a single issue.

get_context_data(*args, **kwargs)[source]

Add tracker issue data and form to template context.

model

alias of Issue

post(request, *args, **kwargs)[source]

Handle form submission for both labels and close actions.

class core.views.IssueListView(**kwargs)[source]

Bases: ListView

View for displaying a paginated list of all open issues in reverse order.

Variables:
  • model – Model class for cycles

  • paginate_by – Number of items per page

get_context_data(*args, **kwargs)[source]

Add open issues’ context data to template.

Parameters:

kwargs – Additional keyword arguments

Returns:

dict

get_queryset()[source]

Return open issues queryset in reverse order with prefetched contributions.

Returns:

QuerySet of open issues in reverse order

Return type:

django.db.models.QuerySet

model

alias of Issue

paginate_by = 20
class core.views.IssueModalView(**kwargs)[source]

Bases: DetailView

View for returning a DaisyUI modal fragment (used by HTMX) to close an issue.

Access rules: - Anonymous → 404 (not redirect) - Only superusers may access modal

Querystring:

?action=addressed (Green button, marks as addressed) ?action=wontfix (Yellow button, marks as wontfix)

Returns:

  • HTML fragment rendered from {% partialdef close_modal_partial %}

  • Never returns a full HTML page

  • Raises Http404 if action is invalid

get(request, *args, **kwargs)[source]

HTMX-only modal endpoint. Only superusers may access. Raises Http404: - if user is not superuser - if ?action is invalid

model

alias of Issue

class core.views.IssueWebhookView(**kwargs)[source]

Bases: View

Main webhook endpoint that uses WebhookHandler for provider delegation.

Variables:

IssueWebhookView.request – Django HTTP request object

dispatch(*args, **kwargs)[source]

Override dispatch method to apply decorators to all HTTP methods.

Parameters:
  • args – positional arguments

  • kwargs – keyword arguments

Returns:

HTTP response

Return type:

class:django.http.HttpResponse

post(request, *args, **kwargs)[source]

Process incoming issue webhook POST request.

Parameters:

request (class:django.http.HttpRequest) – Django HTTP request object

Returns:

JSON response with webhook processing result

Return type:

class:django.http.JsonResponse

class core.views.LoginView(**kwargs)[source]

Bases: LoginView

Custom login view that includes wallet connection context.

get_context_data(**kwargs)[source]

Add wallet and network data to the context.

This method extends the base context data with a list of supported wallets and the currently active network from the user’s session.

Parameters:

kwargs – Additional keyword arguments

Returns:

Context dictionary with wallet and network data

Return type:

dict

class core.views.PrivacyView(**kwargs)[source]

Bases: TemplateView

View for displaying the Privacy Policy page.

Variables:

template_name – HTML template for the privacy page

template_name = 'privacy.html'
class core.views.ProfileDisplay(**kwargs)[source]

Bases: DetailView

Displays user’s profile page

Django generic CBV DetailView needs template and model to be declared.

ProfileEditView is the main class for viewing and updating user/prodfile data and it uses this class as GET part of the process.

get(request, *args, **kwargs)[source]

Handles GET requests and instantiates blank versions of the form

and its inline formset. User editing form is get by class’ get_form method and profile editing formset is instantiated here.

get_form(form_class=None)[source]

Instantiates and returns form for updating profile data

UpdateUserForm is used to instantiate form with instance set to user object and form’s data from the same object

Returns:

instance of profile editing form

model

alias of User

template_name = 'profile.html'
class core.views.ProfileEditView(**kwargs)[source]

Bases: View

Update and displays profile data

dispatch(request, *args, **kwargs)
get(request, *args, **kwargs)[source]

Sets ProfileDisplay get method as its own GET

Returns:

ProfileDisplay as_view method

post(request, *args, **kwargs)[source]

Sets ProfileUpdate post method as its own POST

Returns:

ProfileUpdate as_view method

class core.views.ProfileUpdate(**kwargs)[source]

Bases: UpdateView, SingleObjectMixin

Updates user/profile`data

Django generic CBV UpdateView and SingleObjectMixin needs template, model and form_class to be declared, ProfileEditView is the main class in updating profile data process and it uses this class as the POST part of the process.

form_class

alias of UpdateUserForm

form_invalid(form, profile_form)[source]

Called if a form is invalid. Re-renders the context data with the data-filled forms and errors.

form_valid(form, profile_form)[source]

Called if all forms are valid. Updates a User instance along with associated Profile and then redirects to a success page.

get_form(*args, **kwargs)[source]

Instantiates and returns form for editing user/profile data

Instance’s user object is the request user’s instance and it’s used by form_class to instantiate form.

Returns:

instance of user/profile editing form

get_object(queryset=None)[source]

Returns/sets user object

Overriding this method is Django DetailView requirement

Returns:

user instance

model

alias of User

post(request, *args, **kwargs)[source]

Handles POST requests, instantiating a form instance and its inline formset with the passed POST variables and then checking them for validity.

success_url = '/profile/'
template_name = 'profile.html'
class core.views.RefreshTransparencyDataView(**kwargs)[source]

Bases: RedirectView

View for refreshing transparency data (superusers only).

Variables:

url – URL to redirect to after refreshing data

dispatch(request, *args, **kwargs)
get(request, *args, **kwargs)[source]

Refresh transparency data and redirect to the transparency report page.

Parameters:

request (django.http.HttpRequest) – http request

Returns:

http response

Return type:

django.http.HttpResponseRedirect

url = '/transparency/'
class core.views.SignupView(**kwargs)[source]

Bases: SignupView

Custom signup view that includes wallet connection context.

get_context_data(**kwargs)[source]

Add wallet and network data to the context.

This method extends the base context data with a list of supported wallets and the currently active network from the user’s session.

Parameters:

kwargs – Additional keyword arguments

Returns:

Context dictionary with wallet and network data

Return type:

dict

class core.views.TermsView(**kwargs)[source]

Bases: TemplateView

View for displaying the Terms of Use page.

Variables:

template_name – HTML template for the terms page

template_name = 'terms.html'
class core.views.TransparencyReportView(**kwargs)[source]

Bases: FormView

View for creating transparency reports (superusers only).

Variables:
  • template_name – HTML template for the transparency report page

  • form_class – Form class for creating transparency reports

dispatch(request, *args, **kwargs)
form_class

alias of TransparencyReportForm

form_valid(form)[source]

Process a valid form.

Parameters:

form (core.forms.TransparencyReportForm) – validated form instance

Returns:

http response

Return type:

django.http.HttpResponse

get_context_data(**kwargs)[source]

Add initial data to the context.

Returns:

context dictionary

Return type:

dict

get_form_kwargs()[source]

Add years to the form kwargs.

Returns:

dictionary with form kwargs

Return type:

dict

template_name = 'transparency.html'
class core.views.UnconfirmedContributionsView(**kwargs)[source]

Bases: ListView

View for displaying unconfirmed contribution links.

Variables:
  • model – Model class for contributions

  • paginate_by – Number of items per page

  • template_name – HTML template for the page

get_queryset()[source]

Return queryset of unconfirmed contributions in reverse order.

Returns:

QuerySet of unconfirmed contributions

Return type:

django.db.models.QuerySet

model

alias of Contribution

paginate_by = 20
template_name = 'unconfirmed_contributions.html'

core.management – Project’s management commands package

Initialization module for project’s Django management package.

core.migrations – Main application database migrations package

core.static – Directory holding main application static files

core.static.css – Directory holding main application CSS files

core.templates – Directory holding main application Django template files

core.tests – Main application unit-tests package

Initialization module for core app unit tests.

issues – Package with various issue tracker providers implementation

Initialization module for issues package.

issues.base – Module with base classes for issues and webhooks processing

Module containing base classes for issues and webhooks management.

class issues.base.BaseIssueProvider(user, issue_tracker_api_token=None)[source]

Bases: ABC

Base provider that all providers must inherit from.

Variables:
  • BaseIssueProvider.name – name of the issue provider

  • BaseIssueProvider.user – Django user instance

  • BaseIssueProvider.client – provider client instance

  • BaseIssueProvider.repo – repository/project instance

client = None
close_issue_with_labels(issue_number, labels_to_set=None, comment=None)[source]

Close issue with labels.

Parameters:
  • issue_number (int) – unique issue identifier

  • labels_to_set (list) – collection of labels to set

  • comment (str) – text to add as comment

Variables:
  • client – provider client instance

  • result – operation result from provider-specific implementation

Returns:

operation result

Return type:

dict

create_issue(title, body, labels=None)[source]

Create issue.

Parameters:
  • title (str) – issue title

  • body (str) – issue body

  • labels (list) – issue labels

Variables:
  • client – provider client instance

  • result – operation result from provider-specific implementation

Returns:

operation result

Return type:

dict

fetch_issues(state='all', since=datetime.datetime(2022, 4, 15, 0, 0, tzinfo=datetime.timezone.utc))[source]

Fetch issues from provider.

Parameters:
  • state (str) – issue state filter

  • since (datetime.datetime) – fetch issues updated after this date

Variables:

client – provider client instance

Returns:

collection of issue instances

Return type:

list

issue_by_number(issue_number)[source]

Get issue by number.

Parameters:

issue_number (int) – unique issue identifier

Variables:
  • client – provider client instance

  • result – formatted issue data from provider-specific implementation

Returns:

operation result

Return type:

dict

issue_url(issue_number)[source]

Get full URL of the issue defined by provided issue_number.

Parameters:

issue_number (int) – unique issue identifier

Returns:

full URL to the issue

Return type:

str

name = None
repo = None
set_labels_to_issue(issue_number, labels_to_set)[source]

Set labels to issue.

Parameters:
  • issue_number (int) – unique issue identifier

  • labels_to_set (list) – collection of labels to set

Variables:
  • client – provider client instance

  • result – operation result from provider-specific implementation

Returns:

operation result

Return type:

dict

user = None
class issues.base.BaseWebhookHandler(request)[source]

Bases: ABC

Abstract base class for all webhook handlers.

Variables:
  • BaseWebhookHandler.request – Django HTTP request object

  • BaseWebhookHandler.payload – parsed JSON payload from request

abstractmethod extract_issue_data()[source]

Extract issue data from payload.

Returns:

None if not an issue creation event, dict with issue data if it’s an issue creation

Return type:

dict or None

process_webhook()[source]

Main entry point to process webhook.

Returns:

HTTP response with webhook processing result

Return type:

class:django.http.JsonResponse

abstractmethod validate()[source]

Validate webhook signature/token.

Returns:

True if validation passes, False otherwise

Return type:

bool

issues.bitbucket – Module with classes and functions dealing with Bitbucket issues and webhooks

Module containing functions for Bitbucket issues and webhooks management.

class issues.bitbucket.BitbucketApp[source]

Bases: object

Helper class for instantiating a Bitbucket client using a Bitbucket app.

access_token()[source]

Retrieve an access token for a Bitbucket app installation.

Variables:
  • jwt_token – The JWT token for the app.

  • url – The URL for the token exchange request.

  • headers – The headers for the request.

  • data – The data for the POST request.

  • response – The response from the request.

Returns:

The installation access token.

Return type:

str

jwt_token()[source]

Generate JWT token for a Bitbucket app.

Variables:
  • config – Bitbucket configuration data

  • client_key – The clientKey from the app’s descriptor.

  • shared_secret – The sharedSecret from the app’s installation.

  • now – The current UTC time.

  • expiration – The expiration time for the token (3 minutes).

  • payload – The JWT payload.

Returns:

The JWT token.

Return type:

str

class issues.bitbucket.BitbucketProvider(user, issue_tracker_api_token=None)[source]

Bases: BaseIssueProvider

Bitbucket provider implementation.

name = 'bitbucket'
class issues.bitbucket.BitbucketWebhookHandler(request)[source]

Bases: BaseWebhookHandler

Bitbucket webhook handler for issue creation events.

extract_issue_data()[source]

Extract issue data from Bitbucket webhook payload.

Variables:

issue_data – prepared Bitbucket issue data

Returns:

issue data dict if issue creation detected, None otherwise

Return type:

dict or None

validate()[source]

Validate Bitbucket webhook signature using X-Hub-Signature header.

Returns:

True if signature is valid or no secret configured, False otherwise

Return type:

bool

issues.config – Module for issue providers confirguration from environment variables

Module containing issue trackers configuration.

issues.config.bitbucket_config()[source]

Return Bitbucket configuration from environment variables.

Returns:

Bitbucket configuration dictionary

Return type:

dict

issues.config.github_config()[source]

Return GitHub bot configuration from environment variables.

Returns:

GitHub bot configuration dictionary

Return type:

dict

issues.config.gitlab_config()[source]

Return Telegram configuration from environment variables.

Returns:

Telegram configuration dictionary

Return type:

dict

issues.github – Module with classes and functions dealing with GitHub issues and webhooks

Module containing functions for GitHub issues and webhooks management.

class issues.github.GitHubApp[source]

Bases: object

Helper class for instantiating GitHub client using GitHub bot.

client()[source]

Get authenticated GitHub client using GitHub bot.

Variables:

token – installation access token

Returns:

authenticated GitHub client

Return type:

github.Github

installation_token()[source]

Retrieve installation access token for GitHub bot.

Variables:
  • installation_id – ID of the bot’s installation

  • jwt_token – JWT token for the bot

  • headers – headers for the request

  • url – URL for the request

  • response – response from the request

Returns:

installation access token

Return type:

str

jwt_token()[source]

Generate JWT token for GitHub bot.

Variables:
  • config – Github configuration data

  • bot_private_key_filename – filename of the bot’s private key

  • bot_client_id – client ID of the bot

  • pem_path – path to the bot’s private key

  • signing_key – bot’s private key

  • now – current time

  • expiration – expiration time for the token

  • payload – JWT payload

Returns:

JWT token

Return type:

str

class issues.github.GitHubWebhookHandler(request)[source]

Bases: BaseWebhookHandler

GitHub webhook handler for issue creation events.

extract_issue_data()[source]

Extract issue data from GitHub webhook payload.

Variables:
  • event_type – GitHub issue event type

  • issue – GitHub issue data

  • labels – collection of label names

Returns:

issue data dict if action is ‘opened’, None otherwise

Return type:

dict or None

validate()[source]

Validate GitHub webhook signature using X-Hub-Signature-256 header.

Returns:

True if signature is valid or no secret configured, False otherwise

Return type:

bool

class issues.github.GithubProvider(user, issue_tracker_api_token=None)[source]

Bases: BaseIssueProvider

GitHub provider implementation.

name = 'github'

issues.gitlab – Module with classes and functions dealing with GitLab issues and webhooks

Module containing functions for GitLab issues and webhooks management.

class issues.gitlab.GitLabWebhookHandler(request)[source]

Bases: BaseWebhookHandler

GitLab webhook handler for issue creation events.

extract_issue_data()[source]

Extract issue data from GitLab webhook payload.

Variables:
  • object_kind – GitLab object kind

  • action – GitLab event type

  • issue – GitLab issue data

  • labels – collection of label names

Returns:

issue data dict if object_kind is ‘issue’ and action is ‘open’

Return type:

dict or None

validate()[source]

Validate GitLab webhook token using X-Gitlab-Token header.

Returns:

True if token matches or no token configured, False otherwise

Return type:

bool

class issues.gitlab.GitlabProvider(user, issue_tracker_api_token=None)[source]

Bases: BaseIssueProvider

GitLab provider implementation.

name = 'gitlab'

issues.main – Main issue tracker class and public functions

Module containing main functions for issues management.

class issues.main.IssueProvider(user, **kwargs)[source]

Bases: object

Main provider class that delegates to the configured provider.

Variables:
  • IssueProvider.name – name of the provider to use

  • IssueProvider.user – Django user instance

  • IssueProvider._provider_instance – instance of the issue provider

name = None
user = None
class issues.main.WebhookHandler(request)[source]

Bases: object

Main webhook handler class that delegates to the configured provider.

Variables:
  • WebhookHandler.name – name of the provider to use

  • WebhookHandler.request – Django HTTP request object

  • WebhookHandler._handler_instance – instance of the webhook handler

name = None
process_webhook()[source]

Delegate webhook processing to the handler instance.

Returns:

HTTP response from handler

Return type:

class:django.http.JsonResponse

request = None
issues.main.issue_data_for_contribution(contribution, profile)[source]

Prepare complete issue data dictionary from a contribution.

Parameters:
Returns:

dict

issues.tests – Unit-tests package for the issue trackers package

Initialization module for helpers unit tests.

manage – Django main module

Django’s command-line utility for administrative tasks.

manage.main()[source]

Run administrative tasks.

rewards – Frontend application to the Rewards smart contract

Initialization module for rewards application.

rewards.apps – Configuration module for the smart contract frontend application

Module containing rewards app configuration.

class rewards.apps.RewardsConfig(app_name, app_module)[source]

Bases: AppConfig

default_auto_field = 'django.db.models.BigAutoField'
name = 'rewards'

rewards.urls – Smart contract frontend application URL configuration module

Module containing the URL configuration for the rewards app.

rewards.templates – Directory holding Smart contract frontend applicatio Django template files

rewards.views – Smart contract frontend application views

Module containing the views for the rewards app.

class rewards.views.AddAllocationsView(**kwargs)[source]

Bases: LoginRequiredMixin, TemplateView

View for superusers to add new allocations.

This view provides an interface for users with superuser privileges to add new reward allocations to the smart contract. It is restricted to superusers to prevent unauthorized modifications.

dispatch(request, *args, **kwargs)
get_context_data(**kwargs)[source]

Add any necessary context for the add allocations page.

Parameters:

kwargs – Additional keyword arguments

Returns:

Context dictionary

Return type:

dict

post(request, *args, **kwargs)[source]

Run contract allocation batching when admin account is available.

Parameters:

request (rest_framework.request.Request) – HTTP request object

Returns:

django.http.HttpResponse

template_name = 'rewards/add_allocations.html'
class rewards.views.ClaimView(**kwargs)[source]

Bases: LoginRequiredMixin, TemplateView

View for users to claim their rewards.

This view displays the claim rewards interface, which allows authenticated users to initiate the process of claiming their earned rewards.

get_context_data(**kwargs)[source]

Add claimable status to the context.

This method determines if the current user has a claimable allocation and adds a boolean claimable to the context.

Parameters:

kwargs – Additional keyword arguments

Returns:

Context dictionary with claimable status

Variables:
  • context – data to use in template

  • amount – amount to claim by the user

Return type:

dict

template_name = 'rewards/claim.html'
class rewards.views.ReclaimAllocationsView(**kwargs)[source]

Bases: LoginRequiredMixin, TemplateView

View for superusers to reclaim allocations.

This view allows superusers to reclaim reward allocations from the smart contract. This is typically done for allocations that are no longer valid or need to be returned. Access is restricted to superusers.

dispatch(request, *args, **kwargs)
get_context_data(**kwargs)[source]

Add any necessary context for the reclaim allocations page.

Parameters:

kwargs – Additional keyword arguments

Returns:

Context dictionary

Return type:

dict

post(request, *args, **kwargs)[source]

Handle individual allocation reclaim request.

Parameters:

request (rest_framework.request.Request) – HTTP request object

Returns:

django.http.HttpResponse

template_name = 'rewards/reclaim_allocations.html'

rewards.tests – Smart contract frontend application unit-tests package

Initialization module for rewards app unit tests.

rewardsweb – Main configuration package

Initialization module for rewardsweb project.

rewardsweb.settings – Project’s settings package

Initialization module for Django settings.

rewardsweb.settings.base – Base project’s settings for all infrastructures

Django settings for rewardsweb project.

Generated by ‘django-admin startproject’ using Django 4.2.18.

For more information on this file, see https://docs.djangoproject.com/en/4.2/topics/settings/

For the full list of settings and their values, see https://docs.djangoproject.com/en/4.2/ref/settings/

rewardsweb.settings.development – Project’s settings for development infrastructure

Django settings module used in development.

rewardsweb.settings.production – Project’s settings for production infrastructure

Django settings module used in production.

show-inheritance:

rewardsweb.tests – Project’s unit-tests package

Initialization module for main project unit tests.

rewardsweb.asgi – Module containing asynchronous application

ASGI config for rewardsweb project.

It exposes the ASGI callable as a module-level variable named application.

For more information on this file, see https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/

rewardsweb.urls – Main website’s URL configuration module

URL configuration for rewardsweb project.

The urlpatterns list routes URLs to views. For more information please see:

https://docs.djangoproject.com/en/4.2/topics/http/urls/

Examples:

Function views

  1. Add an import: from my_app import views

  2. Add a URL to urlpatterns: path(‘’, views.home, name=’home’)

Class-based views

  1. Add an import: from other_app.views import Home

  2. Add a URL to urlpatterns: path(‘’, Home.as_view(), name=’home’)

Including another URLconf

  1. Import the include() function: from django.urls import include, path

  2. Add a URL to urlpatterns: path(‘blog/’, include(‘blog.urls’))

rewardsweb.wsgi – Module containing main wsgi application

WSGI config for rewardsweb project.

It exposes the WSGI callable as a module-level variable named application.

For more information on this file, see https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/

trackers – Social media trackers package

Initialization module for trackers package.

trackers.apps – Trackers application configuration module

Module containing trackers app configuration.

class trackers.apps.TrackersConfig(app_name, app_module)[source]

Bases: AppConfig

Main class for core application.

Variables:

TrackersConfig.name – app name

default_auto_field = 'django.db.models.BigAutoField'
name = 'trackers'

trackers.base – Module containing base class for all social media trackers

Module containing base tracker class.

class trackers.base.BaseAsyncMentionTracker(platform_name, parse_message_callback)[source]

Bases: BaseMentionTracker

Async-compatible base class for social media mention trackers.

Variables:

BaseAsyncMentionTracker.session – logger instance for this platform

async check_mentions_async()[source]

Async version of check_mentions.

Returns:

number of new mentions found

Return type:

int

async cleanup()[source]

Perform async cleanup.

async close_session()[source]

Close aiohttp session if it exists.

async initialize_session()[source]

Initialize aiohttp session if not already created.

async is_processed_async(item_id)[source]

Async version of is_processed.

Parameters:

item_id (str) – unique identifier for the social media item

Returns:

True if item has been processed, False otherwise

Return type:

bool

async log_action_async(action, details='')[source]

Log platform actions to database (async version).

Parameters:
  • action (str) – description of the action performed

  • details (str) – additional details about the action

async mark_processed_async(item_id, data)[source]

Async version of mark_processed.

Parameters:
  • item_id (str) – unique identifier for the social media item

  • data (dict) – mention data dictionary

async post_new_contribution_async(contribution_data)[source]

Send add contribution POST request to the Rewards API (async version).

Parameters:

contribution_data (dict) – formatted contribution data

Variables:
  • url – endpoint for adding new contributions

  • data – response data from endpoint

  • error_msg – error message text

Returns:

response data from Rewards API

Return type:

dict

Raises:

Exception – For connection, HTTP, timeout, or other errors

async process_mention_async(item_id, data, username)[source]

Async version of process_mention.

Parameters:
  • item_id (str) – unique identifier for the social media item

  • data (dict) – mention data dictionary

  • username (str) – mentioned username

Variables:
  • parsed_message – parsed message result

  • contribution_data – formatted contribution data

Returns:

True if mention was processed, False otherwise

Return type:

bool

shutdown()[source]

Request graceful shutdown of the running asynchronous task.

Cancels the main async task when called, typically by a signal handler. This method is safe to call multiple times.

Variables:

async_task – the currently running async task to cancel

start_async_task(callback, **kwargs)[source]

Start and run an asynchronous task with proper signal handling.

Creates an event loop, runs the provided async callback as a task, and sets up signal handlers for graceful shutdown. This method blocks until the async task completes or is cancelled.

Parameters:
  • callback (callable) – async function to run as the main task

  • kwargs (dict) – keyword arguments to pass to the callback function

Variables:

event_loop – asyncio event loop for running the async task

class trackers.base.BaseMentionTracker(platform_name, parse_message_callback)[source]

Bases: object

Base class for all social media mention trackers.

Variables:
  • BaseMentionTracker.logger – logger instance for this platform

  • BaseMentionTracker.exit_signal – flag indicating requested graceful shutdown

  • BaseMentionTracker.async_task – asyncio task representing the running callback

check_mentions()[source]

Check for new mentions - to be implemented by subclasses.

Returns:

number of new mentions found

Return type:

int

is_processed(item_id)[source]

Check if item has been processed.

Parameters:

item_id (str) – unique identifier for the social media item

Returns:

True if item has been processed, False otherwise

Return type:

bool

log_action(action, details='')[source]

Log platform actions to database.

Parameters:
  • action (str) – description of the action performed

  • details (str) – additional details about the action

mark_processed(item_id, data)[source]

Mark item as processed in database.

Parameters:
  • item_id (str) – unique identifier for the social media item

  • data (dict) – mention data dictionary

post_new_contribution(contribution_data)[source]

Send add contribution POST request to the Request API.

Parameters:

contribution_data (dict) – formatted contribution data

Variables:
  • base_url – Rewards API base endpoints URL

  • response – requests’ response instance

Returns:

response data from Rewards API

Return type:

dict

prepare_contribution_data(parsed_message, message_data)[source]

Prepare contribution data for POST request from provided arguments.

Check if username is among excluded contributors and if it is then set the username to suggester value instead of contributor.

Parameters:
  • parsed_message (dict) – parsed message result

  • message_data (dict) – original message data

Variables:
  • platform_name – social media provider name

  • platform_prefix – internal username prefix for the platform

  • username – contributor’s username/handle in the platform

Returns:

dict

process_mention(item_id, data, username)[source]

Common mention processing logic.

Parameters:
  • item_id (str) – unique identifier for the social media item

  • data (dict) – mention data dictionary

  • username (str) – mentioned username

Variables:
  • parsed_message – parsed message result

  • contribution_data – formatted contribution data

Returns:

True if mention was processed, False otherwise

Return type:

bool

run(poll_interval_minutes=30, max_iterations=None)[source]

Main run loop for synchronous mention trackers.

Implements shared logic for all polling-based trackers:

  • logs tracker startup and poll interval

  • periodically calls BaseMentionTracker.check_mentions()

  • logs when new mentions are found

  • sleeps between polls in an interruptible way

  • handles graceful shutdown on KeyboardInterrupt and OS signals

  • ensures BaseMentionTracker.cleanup() is always called

Parameters:
  • poll_interval_minutes (int or float) – how often to check for mentions

  • max_iterations (int or None) – maximum number of polls before stopping (None for infinite loop)

Variables:
  • iteration – current iteration count

  • mentions_found – number of new mentions found in current poll

setup_logging()[source]

Setup common logging configuration.

Variables:
  • logs_dir – logs directory name

  • log_filename – filename for the log file

trackers.config – Module for trackers confirguration from environment variables

Module containing trackers configuration.

trackers.config.discord_config()[source]

Return Discord configuration from environment variables.

Variables:
  • excluded_channels_str – comma separated list of excluded channels

  • excluded_channels – formatted collection of excluded channel IDs

  • included_channels_str – comma separated list of included channels

  • included_channels – formatted collection of included channel IDs

Returns:

Discord configuration dictionary

Return type:

dict

trackers.config.discord_guilds()[source]

Return list of Discord guilds/channels to track from environment variable.

Variables:

guilds_str – comma-separated list of guilds from environment

Returns:

list of discord guild IDs

Return type:

list

trackers.config.reddit_config()[source]

Return Reddit configuration from environment variables.

Returns:

Reddit configuration dictionary

Return type:

dict

trackers.config.reddit_subreddits()[source]

Return list of subreddits to track from environment variable.

Variables:

subreddits_str – comma-separated list of subreddits from environment

Returns:

list of subreddit names

Return type:

list

trackers.config.telegram_chats()[source]

Return list of Telegram chats to track from environment variable.

Variables:

chats_str – comma-separated list of chat usernames or IDs from environment

Returns:

list of chat identifiers

Return type:

list

trackers.config.telegram_config()[source]

Return Telegram configuration from environment variables.

Returns:

Telegram configuration dictionary

Return type:

dict

trackers.config.twitter_config()[source]

Return Twitter configuration from environment variables.

Returns:

Twitter configuration dictionary

Return type:

dict

trackers.config.twitterapiio_config()[source]

Return TwitterAPI.io configuration from environment variables.

Returns:

TwitterAPI.io configuration dictionary

Return type:

dict

trackers.discord – Module for processing Discord comments

Module containing class for tracking mentions on Discord across multiple servers.

class trackers.discord.DiscordClientWrapper(intents)[source]

Bases: IDiscordClientWrapper

Concrete implementation of Discord client wrapper.

Parameters:

DiscordClientWrapper._client (discord.Client) – wrapped Discord client instance

async close()[source]

Close the Discord client.

event(func)[source]

Register an event handler.

Parameters:

func (callable) – event handler function

Returns:

decorated function

Return type:

callable

get_channel(channel_id)[source]

Get channel by ID.

Parameters:

channel_id (int) – ID of the channel to get

Returns:

channel object or None

Return type:

discord.abc.GuildChannel or None

get_guild(guild_id)[source]

Get guild by ID.

Parameters:

guild_id (int) – ID of the guild to get

Returns:

guild object or None

Return type:

discord.Guild or None

property guilds

Get the guilds the client is in.

Returns:

list of guilds

Return type:

list of discord.Guild

is_closed()[source]

Check if client is closed.

Returns:

whether client is closed

Return type:

bool

is_ready()[source]

Check if client is ready.

Returns:

whether client is ready

Return type:

bool

async start(token)[source]

Start the Discord client.

Parameters:

token (str) – Discord bot token

property user

Get the client user.

Returns:

client user object

Return type:

discord.ClientUser

class trackers.discord.DiscordTracker(parse_message_callback, discord_config, guilds_collection=None, client_wrapper=None)[source]

Bases: BaseAsyncMentionTracker

Discord tracker for multiple servers/guilds with automatic channel discovery.

Variables:
  • DiscordTracker.client – Discord client wrapper instance

  • DiscordTracker.bot_user_id – user ID of the bot account

  • DiscordTracker.token – Discord bot’s token

  • DiscordTracker.tracked_guilds – list of guild IDs to monitor

  • DiscordTracker.auto_discover_channels – whether to auto-discover channels

  • DiscordTracker.excluded_channel_types – channel types to exclude

async check_mentions_async()[source]

Asynchronously check for new mentions across all tracked channels.

Variables:
  • total_mentions – total number of new mentions found

  • semaphore – semaphore for limiting concurrent channel checks

  • tasks – list of channel check tasks

  • channel_mentions – mentions from individual channel checks

Returns:

total number of new mentions processed

Return type:

int

async cleanup()[source]

Perform graceful cleanup for the Discord tracker.

async extract_mention_data(message)[source]

Extract standardized data from Discord message.

Parameters:

message (discord.Message) – Discord message object

Variables:
  • author – user who sent the message

  • referenced_message – message that this message replies to

  • channel – channel where message was sent

  • guild – Discord server where message was sent

  • data – extracted mention data dictionary

Returns:

standardized mention data

Return type:

dict

get_stats()[source]

Get statistics about the current tracking state.

Variables:
  • stats – dictionary containing tracking statistics

  • guild_id – ID of guild in tracking

  • channel_ids – list of channel IDs for guild

  • guild – guild object retrieved by ID

  • guild_name – name of the guild or placeholder

Returns:

tracking statistics

Return type:

dict

async run_continuous(historical_check_interval)[source]

Run Discord tracker in continuous mode with periodic historical checks.

Registers signal handlers for graceful shutdown, starts the Discord client and then runs the main loop until the client is closed or an interrupt is received.

Parameters:

historical_check_interval (int) – how often to run historical checks (seconds)

Variables:
  • last_historical_check – timestamp of last historical check

  • last_channel_discovery – timestamp of last channel discovery

  • mentions_found – number of mentions found in historical check

class trackers.discord.IDiscordClientWrapper[source]

Bases: ABC

Abstract interface for Discord client to improve testability.

abstractmethod async close()[source]

Close the Discord client.

abstractmethod event(func)[source]

Register an event handler.

Parameters:

func (callable) – event handler function

Returns:

decorated function

Return type:

callable

abstractmethod get_channel(channel_id)[source]

Get channel by ID.

Parameters:

channel_id (int) – ID of the channel to get

Returns:

channel object or None

Return type:

discord.abc.GuildChannel or None

abstractmethod get_guild(guild_id)[source]

Get guild by ID.

Parameters:

guild_id (int) – ID of the guild to get

Returns:

guild object or None

Return type:

discord.Guild or None

abstractmethod is_closed()[source]

Check if client is closed.

Returns:

whether client is closed

Return type:

bool

abstractmethod is_ready()[source]

Check if client is ready.

Returns:

whether client is ready

Return type:

bool

abstractmethod async start(token)[source]

Start the Discord client.

Parameters:

token (str) – Discord bot token

trackers.models – Trackers application ORM module

Module containing trackers’ ORM models.

class trackers.models.Mention(*args, **kwargs)[source]

Bases: Model

Social media mention’s data model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

get_next_by_processed_at(*, field=<django.db.models.fields.DateTimeField: processed_at>, is_next=True, **kwargs)
get_previous_by_processed_at(*, field=<django.db.models.fields.DateTimeField: processed_at>, is_next=False, **kwargs)
item_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <trackers.models.MentionManager object>
platform

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

processed_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

raw_data

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

suggester

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class trackers.models.MentionLog(*args, **kwargs)[source]

Bases: Model

Social media mention log’s data model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

action

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

details

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=True, **kwargs)
get_previous_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <trackers.models.MentionLogManager object>
platform

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

timestamp

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class trackers.models.MentionLogManager(*args, **kwargs)[source]

Bases: Manager

Social media mention log’s data manager.

log_action(platform_name, action, details='')[source]

Log platform actions to database.

Parameters:
  • platform_name (str) – name of the social media platform

  • action (str) – description of the action performed

  • details (str) – additional details about the action

Returns:

MentionLog

class trackers.models.MentionManager(*args, **kwargs)[source]

Bases: Manager

Social media mention’s data manager.

is_processed(item_id, platform_name)[source]

Check if item has been processed.

Parameters:
  • item_id (str) – unique identifier for the social media item

  • platform_name (str) – name of the social media platform

Returns:

True if item has been processed, False otherwise

Return type:

bool

last_processed_timestamp(platform_name)[source]

Get the timestamp of the last processed mention for a platform.

This method retrieves the highest timestamp from all processed mentions for a specific platform. The timestamp is extracted from the raw_data JSON field. This is used by trackers to fetch only new mentions since the last successfully processed item.

Parameters:

platform_name (str) – The name of the social media platform.

Returns:

The Unix timestamp of the last processed mention, or None if no mentions are found for the platform.

Return type:

int or None

mark_processed(item_id, platform_name, data)[source]

Mark item as processed in database.

Parameters:
  • item_id (str) – unique identifier for the social media item

  • platform_name (str) – name of the social media platform

  • data (dict) – mention data dictionary

Returns:

Mention

message_from_url(url)[source]

Retrieve message content from provided url.

Parameters:

url (str) – URL to get message from

Variables:

mention – mention data from database

Returns:

dictionary with message data

Return type:

dict

trackers.parser – Module cointaining class for parsing sociial media messages

This module provides a class for parsing social media messages.

class trackers.parser.MessageParser[source]

Bases: object

A parser for social media messages to extract type, level, and title.

parse(message, arg)[source]

Parse a social media message to extract type, level, and title.

Parameters:
  • message (str) – The message string to parse.

  • arg (str) – The argument to remove from the message (e.g., a username).

Returns:

A dictionary containing the parsed type, level, and title.

Return type:

dict

trackers.reddit – Module for processing Reddit comments

Module containing class for tracking mentions on Reddit.

class trackers.reddit.RedditTracker(parse_message_callback, config, subreddits_to_track)[source]

Bases: BaseMentionTracker

Tracker for Reddit mentions across specified subreddits.

Variables:
  • RedditTracker.reddit – authenticated Reddit instance

  • RedditTracker.bot_username – username of the bot account

  • RedditTracker.tracked_subreddits – list of subreddits being monitored

check_mentions()[source]

Check for new mentions across all tracked subreddits.

Variables:
  • mention_count – number of new mentions found

  • subreddit_name – name of current subreddit being checked

  • subreddit – Reddit subreddit object

  • comment – comment from subreddit

  • submission – submission from subreddit

  • data – extracted mention data

Returns:

number of new mentions processed

Return type:

int

extract_mention_data(item)[source]

Extract standardized data from Reddit item.

Parameters:

item (praw.models.Comment or praw.models.Submission) – Reddit comment or submission

Returns:

standardized mention data dictionary

Return type:

dict

run(poll_interval_minutes=30, max_iterations=None)[source]

Run Reddit mentions tracker.

Uses the shared base tracker loop for polling and processing mentions.

Parameters:
  • poll_interval_minutes (int or float) – how often to check for mentions

  • max_iterations (int or None) – maximum number of polls before stopping (None for infinite loop)

trackers.runners – Module containing trackers run functions

Module containing social media trackers’ run functions.

trackers.runners.run_discord_tracker()[source]

Initialize related arguments and run asynchronous Discord mentions tracker.

Variables:
  • config – configuration dictionary for Discord API

  • tracker – custom Discord tracker instance

trackers.runners.run_reddit_tracker()[source]

Initialize related arguments and run Reddit mentions tracker.

Variables:
  • config – configuration dictionary for Reddit API

  • tracker – custom Reddit tracker instance

trackers.runners.run_telegram_tracker()[source]

Initialize related arguments and run Telegram mentions tracker.

Variables:
  • config – configuration dictionary for Telegram API

  • tracker – custom Telegram tracker instance

trackers.runners.run_twitter_tracker()[source]

Initialize related arguments and run Twitter mentions tracker.

Variables:
  • config – configuration dictionary for X API

  • tracker – custom Twitter tracker instance

trackers.runners.run_twitterapiio_tracker()[source]

Initialize related arguments and run X mentions tracker using TwitterAPI.io.

Variables:
  • config – configuration dictionary for TwitterAPI.io

  • tracker – custom TwitterAPI.io tracker instance

trackers.telegram – Module for processing Telegram messages

Module containing class for tracking mentions on Telegram.

class trackers.telegram.TelegramTracker(parse_message_callback, config, chats_collection)[source]

Bases: BaseAsyncMentionTracker

Tracker for Telegram mentions in specified groups/channels.

Variables:
  • TelegramTracker.client – Telegram client instance

  • TelegramTracker.bot_username – username of the bot account

  • TelegramTracker.tracked_chats – list of chats being monitored

  • TelegramTracker._is_connected – is client connected or not

check_mentions()[source]

Check for new mentions across all tracked chats.

Returns:

number of new mentions processed

Return type:

int

async check_mentions_async()[source]

Asynchronously check for new mentions across all tracked chats.

Variables:
  • total_mentions – total number of new mentions found

  • chat – chat identifier from tracked chats

  • chat_mentions – mentions found in current chat

Returns:

total number of new mentions processed

Return type:

int

async cleanup()[source]

Perform graceful cleanup of the Telegram client.

async extract_mention_data(message)[source]

Extract standardized data from a Telegram message.

This method processes a Telegram message to extract structured information about the suggester, the suggestion, and any replied-to contribution.

Parameters:

message (telethon.tl.types.Message) – The Telegram message object to be processed.

Returns:

A dictionary containing standardized mention data.

Variables:
  • chat – The chat where the message was sent.

  • sender_info – Information about the message sender.

  • replied_info – Information about the replied-to message, if any.

  • contribution_url – The URL of the contribution.

  • contributor_info – Information about the contributor.

  • contribution – The text of the contribution.

Return type:

dict

run(poll_interval_minutes=30)[source]

Run Telegram mentions tracker.

Parameters:

poll_interval_minutes (int or float) – how often to check for mentions

async run_async(poll_interval_minutes=30)[source]

Async version of the main run loop.

Parameters:

poll_interval_minutes (int or float) – how often to check for mentions

trackers.twitter – Module for processing comments on X/Twitter using official API

Module containing class for tracking mentions on X/Twitter.

class trackers.twitter.TwitterTracker(parse_message_callback, config)[source]

Bases: BaseMentionTracker

Tracker for Twitter mentions of the bot account.

Variables:
  • TwitterTracker.client – authenticated Twitter client

  • TwitterTracker.target_user_id – Twitter user ID to track

check_mentions()[source]

Check for new mentions on Twitter.

Variables:
  • mention_count – number of new mentions found

  • mentions – recent mentions from Twitter API

  • user_map – mapping of user IDs to usernames from API response

  • tweet – individual tweet from mentions

  • data – extracted mention data

Returns:

number of new mentions processed

Return type:

int

extract_mention_data(tweet, user_map)[source]

Extract standardized data from Twitter mention.

Parameters:
  • tweet (tweepy.models.Tweet) – Twitter tweet object

  • user_map (dict) – mapping of user IDs to usernames

Variables:
  • suggester_username – username of the user who mentioned the bot

  • contribution_url – URL to the contribution tweet

  • contributor – username of the contributor

  • contribution – text of the original tweet

  • suggestion_url – URL to the suggestion tweet

  • data – extracted data dictionary

Returns:

standardized mention data

Return type:

dict

run(poll_interval_minutes=15, max_iterations=None)[source]

Run Twitter mentions tracker.

Uses the shared base tracker loop for polling and processing mentions.

Parameters:
  • poll_interval_minutes (int or float) – how often to check for mentions

  • max_iterations (int or None) – maximum number of polls before stopping (None for infinite loop)

trackers.twitterapiio – Module for processing comments on X/Twitter using TwitterAPI.io

Module containing class for tracking mentions on X using TwitterAPI.io.

class trackers.twitterapiio.TwitterapiioTracker(parse_message_callback, config)[source]

Bases: BaseMentionTracker

Tracker for Twitter mentions of a specific account using the TwitterAPI.io service.

This class handles fetching new mentions, retrieving the parent tweets of replies in efficient batches, and saving the timestamp of the last processed mention to avoid reprocessing.

Variables:
  • TwitterapiioTracker.api_key – API key for the TwitterAPI.io service

  • TwitterapiioTracker.target_handle – Twitter screen name of the account to track

  • TwitterapiioTracker.batch_size – number of mentions to collect in a batch

  • TwitterapiioTracker.starting_timestamp – timestamp to start fetching mentions

check_mentions()[source]

Check for new Twitter mentions and process them.

This method fetches new mentions, filters out any that have already been processed, extracts relevant data, and processes the new mentions.

Returns:

The number of new mentions found and processed.

Return type:

int

Variables:
  • last_timestamp – The last saved Unix timestamp retrieved from the database.

  • start_time – The Unix timestamp from which to start fetching new mentions.

  • mentions_found – A counter for the number of new mentions found and processed.

  • mention_generator – A generator yielding mention tweet objects.

  • mention – An individual mention tweet object from the generator.

  • tweet_id – The ID of the current tweet being processed.

  • data – Standardized mention data prepared for processing.

extract_mention_data(mention)[source]

Extract relevant data from a mention tweet.

Parameters:

mention (dict) – The mention tweet object from the Twitter API.

Returns:

A dictionary containing standardized mention data.

Return type:

dict

Variables:
  • tweet_id – The ID of the mention tweet.

  • parent_tweet_url – The URL of the parent tweet, if it exists.

  • contributor_handle – The Twitter handle of the contributor.

  • contribution – The text content of the parent tweet.

run(poll_interval_minutes=15, max_iterations=None)[source]

Run Twitter mentions tracker.

Uses the shared base tracker loop for polling and processing mentions.

Parameters:
  • poll_interval_minutes (int or float) – how often to check for mentions

  • max_iterations (int or None) – maximum number of polls before stopping (None for infinite loop)

trackers.tests – Unit-tests package for trackers package

Initialization module for trackers unit tests.

updaters – Social media messages updating package

updaters.base – Module containing base class for all social media updaters

Base classes for updating social media messages.

class updaters.base.BaseUpdater[source]

Bases: ABC

Base class for all social media message updaters.

abstractmethod add_reaction_to_message(url, reaction_name)[source]

Add reaction to message.

Parameters:
  • url (str) – URL of the message to react to

  • reaction_name (str) – name of the reaction to add (e.g. “duplicate”)

abstractmethod add_reply_to_message(url, text)[source]

Add reply to message.

Parameters:
  • url (str) – URL of the message to reply to

  • text (str) – text to reply with

abstractmethod message_from_url(url)[source]

Get message from URL.

Parameters:

url (str) – URL to get message from

updaters.discord – Module for updating Discord comments

Module containing class for sending Discord messages.

class updaters.discord.DiscordUpdater(*args, **kwargs)[source]

Bases: BaseUpdater

Discord updater.

add_reaction_to_message(url, reaction_name)[source]

Add a reaction to an existing Discord message

Parameters:
  • url (str) – Discord message’s URL

  • reaction_name (str) – name of the reaction to add (e.g. “duplicate”)

Variables:
  • channel_id – ID of the channel containing the message

  • message_id – ID of the message to react to

  • headers – headers instance carrying bot token

  • api_url – fully formatted API URL to add reaction to the message

  • response – HTTP response instance

Returns:

Boolean

add_reply_to_message(url, comment)[source]

Add a reply to an existing Discord message

Parameters:
  • url (str) – Discord message URL

  • comment (str) – reply message content

Variables:
  • headers – headers instance carrying bot token and content type

  • api_url – fully formatted API URL to create message in channel

  • payload – request payload containing reply message data

  • response – HTTP response instance

Returns:

Boolean indicating success

Return type:

bool

message_from_url(url)[source]

Retrieve message content from provided Discord url.

Variables:
  • channel_id – ID of the channel containing the message

  • headers – headers instance carrying bot token

  • api_url – fully formatted API URL to retrieve message

  • response – HTTP response instance

  • message_data – Discord message data

Parameters:

message_id (str) – ID of the message to react to

Returns:

Boolean

updaters.main – Module containing main updating class and updaters regiustry

Module containing main class for updaters management.

class updaters.main.UpdateProvider(platform_name)[source]

Bases: object

Main updater provider class that delegates to the correct platform updater.

Variables:
  • UpdateProvider.name – name of the provider to use

  • UpdateProvider.user – Django user instance

  • UpdateProvider._updater_instance – instance of the updater provider

name = None

updaters.reddit – Module for updating Reddit comments

Module containing class for adding replies to Reddit posts and comments.

class updaters.reddit.RedditUpdater(*args, **kwargs)[source]

Bases: BaseUpdater

Main class for retrieving and adding Reddit post and comments.

Variables:

RedditUpdater.client – authenticated Reddit client

add_reaction_to_message(url, reaction_name)[source]

Add reaction to Reddit message.

Parameters:
  • url (str) – URL of the message to react to

  • reaction_name (str) – name of the reaction to add (e.g. “duplicate”)

Returns:

Reddit doesn’t implement emoji rections so we just return True

Return type:

Boolean

add_reply_to_message(url, text)[source]

Add reply to Reddit message.

Parameters:
  • url (str) – URL of the Reddit post/comment to reply to

  • text (str) – text to reply with

Variables:
  • submission_id – Reddit post/submission identifier

  • comment_id – Reddit comment identifier

  • comment – Reddit comment identifier

  • submission – Reddit comment identifier

Returns:

True for success, False otherwise

Return type:

Boolean

message_from_url(url)[source]

Retrieve message content from provided Reddit url.

Parameters:

url (str) – Reddit URL to get message from

Returns:

dictionary with message data

Return type:

dict

updaters.telegram – Module for updating Telegram messages

Module containing class for sending Telegram replies and emoji reactions.

class updaters.telegram.TelegramUpdater(*args, **kwargs)[source]

Bases: BaseUpdater

Main class for retrieving and adding Telegram messages.

Variables:
  • TelegramUpdater.client – authenticated Telegram client

  • TelegramUpdater._is_connected – is client connected or not

add_reaction_to_message(url, reaction_name)[source]

Add reaction to the Telegram message defined by url.

NOTE: not implemented yet

Parameters:
  • url (str) – URL of the message to react to

  • reaction_name (str) – name of the reaction to add (e.g. “duplicate”)

Returns:

True for success, False otherwise

Return type:

Boolean

add_reply_to_message(url, text)[source]

Add text to message defined by url.

Parameters:
  • url (str) – URL of the message to reply to

  • text (str) – text to reply with

Returns:

True for success, False otherwise

Return type:

bool

message_from_url(url)[source]

Retrieve message content from provided Telegram url.

Parameters:

url (str) – Telegram URL to get message from

Returns:

dictionary with message data

Return type:

dict

updaters.twitter – Module for updating comments on X/Twitter

Module containing class for sending X/Twitter messages.

class updaters.twitter.TwitterUpdater(*args, **kwargs)[source]

Bases: BaseUpdater

Main class for retrieving and adding X/Twitter messages.

Variables:

TwitterUpdater.client – authenticated Twitter client

add_reaction_to_message(url, reaction_name)[source]

Add reaction to message.

Parameters:
  • url (str) – URL of the message to react to

  • reaction_name (str) – name of the reaction to add (e.g. “duplicate”)

Returns:

X/Twiiter doesn’t implement emoji rections so we just return True

Return type:

Boolean

add_reply_to_message(url, text)[source]

Add reply text to the tweet defined by url.

Parameters:
  • url (str) – URL of the message to reply to

  • text (str) – text to reply with

Variables:
  • tweet_id_match – tweet ID matching object

  • tweet_id – unique tweet identifier

  • response – Tweepy client’s response object

Returns:

True for success, False otherwise

Return type:

Boolean

message_from_url(url)[source]

Retrieve message content from provided Twitter url.

Parameters:

url (str) – twitter URL to get message from

Returns:

dictionary with message data

Return type:

dict

updaters.tests – Unit-tests package for updaters package

utils – Package with various website’s utility functions and constants

Initialization module for utils package.

utils.constants – Website’s constants package

Initialization module for constants module.

utils.constants.core – Main application constants

Module containing core app’s constants.

utils.importers – Website’s utility functions for importing data from the old system

Module containing functions for importing existing data to database.

utils.importers.import_from_csv(contributions_path, legacy_contributions_path)[source]

Import contributions from CSV files to database.

Parameters:
  • contributions_path (str) – Path to current contributions CSV file

  • legacy_contributions_path (str) – Path to legacy contributions CSV file

Returns:

Error message string or False if successful

Return type:

str or bool

utils.mappers – Website’s utility functions for mapping existing GitHub issues

Module containing helper functions for GitHub issues mapping.

class utils.mappers.CustomIssue(issue: Any, comments: List[Any])[source]

Bases: object

A simple data class for issues and comments.

comments: List[Any]
issue: Any
utils.mappers.map_github_issues(issue_tracker_api_token='')[source]

Fetch existing GitHub issues and create database records from them.

Parameters:

issue_tracker_api_token (str) – GitHub API token

Variables:
  • github_issues – collection of GitHub issue instances

  • closed_size – number of issues created from closed GitHub issues

  • size – number of issues created from GitHub issues

Returns:

Boolean

utils.helpers – Website’s helper utility functions

Module containing projects’ helper functions.

utils.helpers.calculate_transpareny_report_period(report_type, month=None, quarter=None, year=None, start_date_str=None, end_date_str=None)[source]

Calculate start and end dates based on report type and parameters.

Parameters:
  • report_type (str) – Type of report (monthly, quarterly, yearly, custom)

  • month (int or None) – Month number (1-12) for monthly reports

  • quarter (int or None) – Quarter number (1-4) for quarterly reports

  • year (int or None) – Year for reports

  • start_date_str (str or None) – Start date string for custom reports (YYYY-MM-DD)

  • end_date_str (str or None) – End date string for custom reports (YYYY-MM-DD)

Returns:

Tuple of (start_date, end_date)

Return type:

two-tuple

utils.helpers.convert_and_clean_excel(input_file, output_file, legacy_contributions)[source]

Convert and clean Excel file to CSV format for import.

Parameters:
  • input_file (str) – Path to input Excel file

  • output_file (str) – Path to output CSV file for current contributions

  • legacy_contributions (str) – Path to output CSV file for legacy contributions

utils.helpers.get_env_variable(name, default=None)[source]

Return environment variable with provided name.

Raise ImproperlyConfigured exception if such variable isn’t set.

Parameters:
  • name (str) – name of environment variable

  • default (str) – environment variable’s default value

Returns:

str

utils.helpers.humanize_contributions(contributions)[source]

Return collection of provided contributions formatted for output.

Parameters:

contributions (django.db.models.query.QuerySet) – collectin of users’ contribution instances

Returns:

list

utils.helpers.parse_full_handle(full_handle)[source]

Return social platform’s prefix and user’s handle from provided full_handle.

Parameters:

full_handle (str) – contributor’s unique identifier (platform prefix and handle)

Variables:
  • prefix – unique social platform’s prefix

  • handle – contributor’s handle/username

  • platform – social platform’s model instance

Returns:

two-tuple

utils.helpers.read_pickle(filename)[source]

Return collection of key and values created from provided filename pickle file.

Parameters:

filename (pathlib.Path) – full path to pickle file

Returns:

dict with loaded data or empty dict if file doesn’t exist or is corrupted

utils.helpers.social_platform_prefixes()[source]

Return list of social platforms with their prefixes.

Returns:

List of tuples (platform_name, prefix)

Return type:

list

utils.helpers.user_display(user)[source]

Return human readable representation of provided user instance.

Parameters:

user (class:django.contrib.auth.models.User) – user instance

Returns:

str

utils.helpers.verify_signed_transaction(stxn)[source]

Verify the signature of a signed transaction.

This function checks whether a signed Algorand transaction has a valid signature. It handles both regular transactions and transactions with rekeying by verifying the signature against the appropriate public key (sender or authorizing address).

Parameters:

stxn (algosdk.transaction.SignedTransaction) – signed transaction instance to verify

Returns:

True if the signature is valid, False otherwise

Return type:

bool

Raises:

This function catches BadSignatureError internally and returns False, so it doesn’t raise any exceptions for invalid signatures.

utils.tests – Unit tests for website’s utils package

Initialization module for helpers unit tests.

walletauth – Wallet connecting authentication application

Initialization module for walletauth application.

walletauth.apps – Wallet connecting authentication application configuration module

Module containing walletauth app configuration.

class walletauth.apps.WalletauthConfig(app_name, app_module)[source]

Bases: AppConfig

Main class for core application.

Variables:

WalletauthConfig.name – app name

default_auto_field = 'django.db.models.BigAutoField'
name = 'walletauth'

walletauth.models – Wallet connecting authentication application ORM module

Module containing walletauth app’s ORM models.

class walletauth.models.WalletNonce(*args, **kwargs)[source]

Bases: Model

Model used for creating unique secret for wallet authentication.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

address

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_expired()[source]

Consider expired after 5 minutes.

Returns:

Boolean

mark_used()[source]

Mark this instance as already used.

nonce

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
used

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

walletauth.urls – Wallet connecting authentication application URL configuration module

Module containing walletauth app’s URL configuration.

walletauth.views – Wallet connecting authentication application views

Module containing views for wallet authorization and authentication.

class walletauth.views.ActiveNetworkAPIView(**kwargs)[source]

Bases: APIView

Get or update the active network stored in the session.

  • GET returns the currently active network (default: testnet)

  • POST sets a new active network

Parameters:

request – HTTP request object

Returns:

JSON response with network information or error

get(request, *args, **kwargs)[source]

Handle GET request to retrieve the active network.

Parameters:

request – HTTP request object

Returns:

JSON response with: - network (str): current active network name

post(request, *args, **kwargs)[source]

Handle POST request to set the active network.

Expects JSON with:
  • network (str): network to set (must be in WALLET_CONNECT_NETWORK_OPTIONS)

Parameters:

request – HTTP request object

Returns:

JSON response with: - success (bool): True if network was updated - network (str): network that was set OR - error (str): message if invalid input provided

class walletauth.views.AddAllocationsAPIView(**kwargs)[source]

Bases: APIView

Provide data for adding new allocations.

post(request, *args, **kwargs)[source]

Return allocation data for the received address.

Expected JSON:
  • address (str): Algorand wallet address

Parameters:

request – HTTP request object

Returns:

JSON response with: - addresses (list[str]) - amounts (list[int]) OR error message

class walletauth.views.AllocationsSuccessfulAPIView(**kwargs)[source]

Bases: APIView

Mark allocations as successful.

permission_classes = [<class 'rest_framework.permissions.IsAdminUser'>]
post(request, *args, **kwargs)[source]

Update status of related issues to PROCESSED.

Expected JSON:
  • addresses (list[str])

  • txIDs (list[str])

Parameters:

request – HTTP request object

Returns:

JSON response with: - success (bool) OR error message

class walletauth.views.ClaimSuccessfulAPIView(**kwargs)[source]

Bases: APIView

Mark all user’s contributions as claimed.

post(request, *args, **kwargs)[source]

Update status of related issues to ARCHIVED.

Expected JSON:
  • address (str)

  • txIDs (str)

Parameters:

request – HTTP request object

Returns:

JSON response with: - success (bool) OR error message

class walletauth.views.ReclaimAllocationsAPIView(**kwargs)[source]

Bases: APIView

Provide a list of allocations that can be reclaimed.

post(request, *args, **kwargs)[source]

Return reclaimable allocation data.

Expected JSON:
  • address (str)

Parameters:

request – HTTP request object

Returns:

JSON response with reclaimable allocation data

class walletauth.views.ReclaimSuccessfulAPIView(**kwargs)[source]

Bases: APIView

Mark reclaim allocation as successful.

permission_classes = [<class 'rest_framework.permissions.IsAdminUser'>]
post(request, *args, **kwargs)[source]

Update status of related issues to PROCESSED.

Expected JSON:
  • address (str)

  • txID (str)

Parameters:

request – HTTP request object

Returns:

JSON response with: - success (bool) OR error message

class walletauth.views.WalletNonceAPIView(**kwargs)[source]

Bases: APIView

Generate nonce for wallet authentication.

post(request, *args, **kwargs)[source]

Create nonce linked to address.

Expected JSON:
  • address (str)

Parameters:

request – HTTP request object

Returns:

JSON response with: - nonce (str) - prefix (str)

class walletauth.views.WalletVerifyAPIView(**kwargs)[source]

Bases: APIView

Verify wallet signature and log the user in.

post(request, *args, **kwargs)[source]

Verify signed transaction and authenticate the user.

Expected JSON:
  • address (str)

  • signedTransaction (str)

  • nonce (str)

Returns:

JSON { “success”: bool, “redirect_url”: “/” } on success

class walletauth.views.WalletsAPIView(**kwargs)[source]

Bases: APIView

Retrieve a list of supported wallets.

Parameters:

request – HTTP request object

Returns:

JSON response containing supported wallets

get(request, *args, **kwargs)[source]

Handle GET request to return supported wallets.

Parameters:

request – HTTP request object

Returns:

JSON list of supported wallets, each containing: - id (str): wallet identifier - name (str): user-friendly wallet name

walletauth.migrations – Wallet connecting authentication application database migrations package

walletauth.tests – Wallet connecting authentication application unit-tests package

Initialization module for walletauth app unit tests.