Skip to content
This repository has been archived by the owner on Aug 27, 2019. It is now read-only.

Commit

Permalink
some field completion requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
stvnrlly committed Nov 29, 2016
1 parent 2ee05cc commit b43c8cd
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
3 changes: 3 additions & 0 deletions projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ class Meta:
)
class ProjectAdmin(admin.ModelAdmin):
form = ProjectForm

def get_readonly_fields(self, request, obj=None):
return obj.locked_fields()
48 changes: 48 additions & 0 deletions projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,52 @@ def qasp_status(self):
else:
return 'Incomplete'

def ready_to_issue(self):
required_fields = [
self.name,
self.description,
self.contractual_history,
self.project,
self.contracting_office,
self.contracting_officer,
self.contracting_specialist,
self.base_period_length,
self.option_periods,
self.option_period_length,
self.acquisition_plan,
self.qasp,
self.dollars,
self.public,
self.rfq_id,
self.procurement_method,
self.set_aside_status,
self.github_repository,
]
if None in required_fields:
return False
else:
return True

def locked_fields(self):
if self.award_date:
locked = [
'qasp',
'acquisition_plan',
'rfq_id',
'contracting_office',
'contracting_officer',
'contracting_specialist',
'set_aside_status',
'procurement_method',
'base_period_length',
'option_periods',
'option_period_length',
'dollars'
]
else:
locked = []
return locked

def clean(self):
# Check that buy is not public without associated project being public
if (self.project.public is not True) and (self.public is True):
Expand All @@ -479,6 +525,8 @@ def clean(self):
'dollars': 'Value can\'t exceed value of overall project'
})

# Don't allow issue date without a lot of other stuff

# Don't allow award date without issue date
if self.award_date and not self.issue_date:
raise ValidationError({
Expand Down

0 comments on commit b43c8cd

Please sign in to comment.