Skip to content

Commit

Permalink
WIP: refactoring of FAIRshakeAPI.views for version controlled assessment
Browse files Browse the repository at this point in the history
References #43
References #46
  • Loading branch information
u8sand committed Sep 10, 2018
1 parent 13432c9 commit c81ce76
Show file tree
Hide file tree
Showing 5 changed files with 260 additions and 211 deletions.
57 changes: 39 additions & 18 deletions FAIRshakeAPI/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,58 @@ class Meta:
class ProjectForm(IdentifiableForm):
class Meta:
model = models.Project
exclude = ('authors',)
fields = (
'title',
'url',
'description',
'image',
'tags',
'type',
'digital_objects',
)

class DigitalObjectForm(IdentifiableForm):
class Meta:
model = models.DigitalObject
exclude = ('authors',)
fields = (
'title',
'url',
'description',
'image',
'tags',
'type',
'fairsharing',
'rubrics',
)

class RubricForm(IdentifiableForm):
class Meta:
model = models.Rubric
exclude = ('authors',)
fields = (
'title',
'url',
'description',
'image',
'tags',
'type',
'license',
'metrics',
)

class MetricForm(IdentifiableForm):
class Meta:
model = models.Metric
exclude = ('authors',)

class AssessmentForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(AssessmentForm, self).__init__(*args, **kwargs)

self.fields['target'].widget = forms.HiddenInput()
self.fields['rubric'].widget = forms.HiddenInput()
self.fields['project'].widget = forms.HiddenInput()

class Meta:
model = models.Assessment
fields = (
'target',
'rubric',
'project',
'title',
'url',
'description',
'image',
'tags',
'type',
'license',
'rationale',
'principle',
'fairmetrics',
)

class AnswerForm(forms.ModelForm):
Expand Down
Loading

0 comments on commit c81ce76

Please sign in to comment.