grants.models
Define the Grant models.
Copyright (C) 2018 Gitcoin Core
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Grant_team_members
Grant_team_members(self, *args, **kwargs)
Grant_team_members(id, grant, profile)
grant
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.
grant_id
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.
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
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
GrantQuerySet
GrantQuerySet(self, model=None, query=None, using=None, hints=None)
Define the Grant default queryset and manager.
active
GrantQuerySet.active(self)
Filter results down to active grants only.
inactive
GrantQuerySet.inactive(self)
Filter results down to inactive grants only.
keyword
GrantQuerySet.keyword(self, keyword)
Filter results to all Grant objects containing the keywords.
Args: keyword (str): The keyword to search title, description, and reference URL by.
Returns: dashboard.models.GrantQuerySet: The QuerySet of grants filtered by keyword.
Grant
Grant(self, *args, **kwargs)
Define the structure of a Grant.
abi
Return grants abi.
active
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
admin_address
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
admin_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.
admin_profile_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
amount_goal
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
amount_received
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
cancel_tx_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
contract
Return grants contract.
contract_address
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
contract_owner_address
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
contract_version
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
deploy_tx_id
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.
_method
Grant._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
_method
Grant._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
_method
Grant._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
_method
Grant._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, 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.
image_css
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
logo
Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.
logo_svg
The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like::
>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size
Assign a file object on assignment so you can do::
>>> with open('/path/to/hello.world', 'r') as f:
... instance.file = File(f)
metadata
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
milestones
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.
monthly_amount_subscribed
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
network
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
reference_url
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
request_ownership_change
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.
request_ownership_change_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
required_gas_price
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
slug
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
subscriptions
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.
team_members
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example::
class Pizza(Model):
toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
and Topping.pizzas
are ManyToManyDescriptor
instances.
Most of the implementation is delegated to a dynamically defined manager
class built by create_forward_many_to_many_manager()
defined below.
title
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
token_address
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
token_symbol
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
updates
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.
percentage_done
Grant.percentage_done(self)
Return the percentage of token received based on the token goal.
Milestone
Milestone(self, *args, **kwargs)
Define the structure of a Grant Milestone
completion_date
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.
due_date
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
_method
Milestone._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
_method
Milestone._method(self, *, field=<django.db.models.fields.DateField: due_date>, is_next=True, **kwargs)
_method
Milestone._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
_method
Milestone._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
_method
Milestone._method(self, *, field=<django.db.models.fields.DateField: due_date>, is_next=False, **kwargs)
_method
Milestone._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
grant
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.
grant_id
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.
title
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
UpdateQuerySet
UpdateQuerySet(self, model=None, query=None, using=None, hints=None)
Define the Update default queryset and manager.
Update
Update(self, *args, **kwargs)
Define the structure of a Grant Update.
description
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
_method
Update._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
_method
Update._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
_method
Update._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
_method
Update._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
grant
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.
grant_id
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.
title
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
SubscriptionQuerySet
SubscriptionQuerySet(self, model=None, query=None, using=None, hints=None)
Define the Subscription default queryset and manager.
Subscription
Subscription(self, *args, **kwargs)
Define the structure of a subscription agreement.
active
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
amount_per_period
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
cancel_tx_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
contributor_address
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
contributor_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.
contributor_profile_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
contributor_signature
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
end_approve_tx_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
error
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
frequency
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
frequency_unit
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
gas_price
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
_method
Subscription._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
_method
Subscription._method(self, *, field=<django.db.models.fields.DateTimeField: last_contribution_date>, is_next=True, **kwargs)
_method
Subscription._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
_method
Subscription._method(self, *, field=<django.db.models.fields.DateTimeField: next_contribution_date>, is_next=True, **kwargs)
_method
Subscription._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
_method
Subscription._method(self, *, field=<django.db.models.fields.DateTimeField: last_contribution_date>, is_next=False, **kwargs)
_method
Subscription._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
_method
Subscription._method(self, *, field=<django.db.models.fields.DateTimeField: next_contribution_date>, is_next=False, **kwargs)
grant
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.
grant_id
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.
last_contribution_date
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
network
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
new_approve_tx_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
next_contribution_date
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
num_tx_approved
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
num_tx_processed
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
real_period_seconds
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
status
Return grants status, current or past due.
subminer_comments
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
subscription_contribution
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.
subscription_hash
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
token_address
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
token_symbol
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
get_debug_info
Subscription.get_debug_info(self)
Return grants contract.
get_is_ready_to_be_processed_from_db
Subscription.get_is_ready_to_be_processed_from_db(self)
Return true if subscription is ready to be processed according to the DB.
get_is_subscription_ready_from_web3
Subscription.get_is_subscription_ready_from_web3(self)
Return true if subscription is ready to be processed according to web3.
get_check_success_web3
Subscription.get_check_success_web3(self)
Check the return value of the previous function. Returns true if the previous function.
do_cancel_subscription_via_web3
Subscription.do_cancel_subscription_via_web3(self, minutes_to_confirm_within=5)
.Cancels the subscripion on the blockchain
do_execute_subscription_via_web3
Subscription.do_execute_subscription_via_web3(self, minutes_to_confirm_within=5)
.Executes the subscription on the blockchain
helper_tx_dict
Subscription.helper_tx_dict(self, minutes_to_confirm_within=5)
returns a dict like this: {'to': '0xd3cda913deb6f67967b99d67acdfa1712c293601', 'from': web3.eth.coinbase, 'value': 12345}
get_is_active_from_web3
Subscription.get_is_active_from_web3(self)
Return true if subscription is active according to web3.
get_subscription_signer_from_web3
Subscription.get_subscription_signer_from_web3(self)
Return subscription signer.
get_subscription_hash_arguments
Subscription.get_subscription_hash_arguments(self)
Get the grant subscription hash from web3.
Attributes: from (str): Subscription.contributor_address to (str): Grant.admin_address tokenAddress (str): Subscription.token_address tokenAmount (float): Subscription.amount_per_period periodSeconds (int): real_period_seconds in the Subscription model gasPrice (float): Subscription.gas_price nonce (int): The nonce is stored in the Contribution model. its created / managed by sync_geth signature (str): Subscription.contributor_signature
Returns: str: The Subscription hash.
get_hash_from_web3
Subscription.get_hash_from_web3(self)
Returns the grants subscription hash (has to get it from web3).
successful_contribution
Subscription.successful_contribution(self, tx_id)
Create a contribution object.
ContributionQuerySet
ContributionQuerySet(self, model=None, query=None, using=None, hints=None)
Define the Contribution default queryset and manager.
Contribution
Contribution(self, *args, **kwargs)
Define the structure of a subscription agreement.
_method
Contribution._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
_method
Contribution._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
_method
Contribution._method(self, *, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
_method
Contribution._method(self, *, field=<django.db.models.fields.DateTimeField: modified_on>, 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.
subscription
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.
subscription_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
tx_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.