Example #1
0
 def __init__(self, proposal_id, user_id, parent_comment_id, content):
     self.id = gen_random_id(Comment)
     self.proposal_id = proposal_id
     self.user_id = user_id
     self.parent_comment_id = parent_comment_id
     self.content = content[:1000]
     self.date_created = datetime.datetime.now()
Example #2
0
 def __init__(self, **kwargs):
     super().__init__(id=gen_random_id(RFWMilestoneClaim),
                      date_created=datetime.now(),
                      stage=RFWMilestoneClaimStage.REQUESTED,
                      stage_message=kwargs.pop('stage_message', ''),
                      stage_change_date=datetime.now(),
                      stage_url=kwargs.pop('stage_url', ''),
                      **kwargs)
Example #3
0
 def __init__(self, bounty=0, **kwargs):
     if 'index' not in kwargs:
         raise RFWException('Must set index on RFWMilestone')
     super().__init__(id=gen_random_id(RFWMilestone),
                      date_created=datetime.now(),
                      bounty=bounty,
                      title=kwargs.pop('title', ''),
                      content=kwargs.pop('content', ''),
                      effort_from=kwargs.pop('effort_from', 0),
                      effort_to=kwargs.pop('effort_to', 0),
                      **kwargs)
Example #4
0
 def __init__(
     self,
     email_address,
     password,
     active,
     roles,
     display_name=None,
     title=None,
 ):
     self.id = gen_random_id(User)
     self.email_address = email_address
     self.display_name = display_name[:255]
     self.title = title[:255]
     self.password = password
Example #5
0
 def __init__(
     self,
     title: str,
     content: str,
     date: datetime = None,
     user_id: int = None,
     proposal_id: int = None,
 ):
     self.id = gen_random_id(HistoryEvent)
     self.title = title[:120]
     self.content = content[:1000]
     self.user_id = user_id
     self.proposal_id = proposal_id
     self.date = date or datetime.datetime.now()
 def __init__(
         self,
         user_id: int,
         title: str = '',
         brief: str = '',
         content: str = default_content(),
         target: str = '0',
         status: str = CCRStatus.DRAFT,
 ):
     assert CCRStatus.includes(status)
     self.id = gen_random_id(CCR)
     self.date_created = datetime.now()
     self.title = title[:255]
     self.brief = brief[:255]
     self.content = content
     self.target = target
     self.status = status
     self.user_id = user_id
Example #7
0
 def __init__(
         self,
         status: str = ProposalStatus.DRAFT,
         title: str = '',
         brief: str = '',
         content: str = '',
         stage: str = ProposalStage.PREVIEW,
         target: str = '0',
         category: str = ''
 ):
     self.id = gen_random_id(Proposal)
     self.date_created = datetime.datetime.now()
     self.status = status
     self.title = title
     self.brief = brief
     self.content = content
     self.category = category
     self.target = target
     self.stage = stage
 def __init__(
     self,
     title: str,
     brief: str,
     content: str,
     bounty: str,
     date_closes: datetime,
     matching: bool = False,
     status: str = RFPStatus.DRAFT,
 ):
     assert RFPStatus.includes(status)
     self.id = gen_random_id(RFP)
     self.date_created = datetime.now()
     self.title = title[:255]
     self.brief = brief[:255]
     self.content = content
     self.bounty = bounty
     self.date_closes = date_closes
     self.matching = matching
     self.status = status
     self.version = '2'
Example #9
0
 def __init__(
     self,
     index: int,
     title: str,
     content: str,
     date_estimated: datetime,
     payout_amount: str,
     immediate_payout: bool,
     stage: str = MilestoneStage.IDLE,
     proposal_id=int,
 ):
     self.id = gen_random_id(Milestone)
     self.title = title[:255]
     self.content = content[:255]
     self.stage = stage
     self.date_estimated = date_estimated
     self.payout_amount = payout_amount[:255]
     self.immediate_payout = immediate_payout
     self.proposal_id = proposal_id
     self.date_created = datetime.datetime.now()
     self.index = index
Example #10
0
 def create(**kwargs):
     milestones = kwargs.pop('milestones', [{'index': 0}])
     tags = kwargs.pop('tags', [])
     rfw = RFW(id=gen_random_id(RFW),
               date_created=datetime.now(),
               title=kwargs.pop('title', ''),
               brief=kwargs.pop('brief', ''),
               content=kwargs.pop('content', ''),
               status=kwargs.pop('status', RFWStatus.DRAFT),
               category=kwargs.pop('category', Category.COMMUNITY),
               **kwargs)
     db.session.add(rfw)
     db.session.flush()
     # milestones
     for ms in milestones:
         ms.pop('is_new', None)
         rfw.create_milestone(**ms)
     # tags
     for tag_id in tags:
         rfw.add_tag_by_id(tag_id)
     db.session.flush()
     return rfw
Example #11
0
 def __init__(self, **kwargs):
     super().__init__(
         id=gen_random_id(AdminLog),
         date_created=datetime.now(),
         **kwargs
     )
Example #12
0
 def __init__(self, **kwargs):
     super().__init__(id=gen_random_id(RFWWorker),
                      date_created=datetime.now(),
                      status=RFWWorkerStatus.REQUESTED,
                      status_message=kwargs.pop('status_message', ''),
                      **kwargs)
Example #13
0
 def __init__(self, **kwargs):
     super().__init__(id=gen_random_id(Tag), **kwargs)
Example #14
0
 def __init__(self, image_url, user_id):
     self.id = gen_random_id(Avatar)
     self.image_url = image_url
     self.user_id = user_id
Example #15
0
 def __init__(self, proposal_id: int, title: str, content: str):
     self.id = gen_random_id(ProposalUpdate)
     self.proposal_id = proposal_id
     self.title = title[:255]
     self.content = content
     self.date_created = datetime.datetime.now()