SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
67ad70d6
Commit
67ad70d6
authored
3 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Improve eligibility checks
parent
b6d16e0f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scipost_django/colleges/forms.py
+3
-3
3 additions, 3 deletions
scipost_django/colleges/forms.py
scipost_django/colleges/utils.py
+9
-1
9 additions, 1 deletion
scipost_django/colleges/utils.py
with
12 additions
and
4 deletions
scipost_django/colleges/forms.py
+
3
−
3
View file @
67ad70d6
...
...
@@ -288,12 +288,9 @@ class PotentialFellowshipEventForm(forms.ModelForm):
class
FellowshipNominationForm
(
forms
.
ModelForm
):
#profile_id = forms.IntegerField()
class
Meta
:
model
=
FellowshipNomination
fields
=
[
#'profile_id',
'
nominated_by
'
,
# hidden
'
college
'
,
'
nominator_comments
'
# visible
]
...
...
@@ -301,6 +298,9 @@ class FellowshipNominationForm(forms.ModelForm):
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
profile
=
kwargs
.
pop
(
'
profile
'
)
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'
college
'
].
queryset
=
College
.
objects
.
filter
(
acad_field
=
self
.
profile
.
acad_field
)
self
.
fields
[
'
college
'
].
empty_label
=
None
self
.
fields
[
'
nominator_comments
'
].
widget
.
attrs
[
'
rows
'
]
=
4
self
.
helper
=
FormHelper
()
self
.
helper
.
layout
=
Layout
(
...
...
This diff is collapsed.
Click to expand it.
scipost_django/colleges/utils.py
+
9
−
1
View file @
67ad70d6
...
...
@@ -2,7 +2,7 @@ __copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__
=
"
AGPL v3
"
from
.models
import
Fellowship
,
FellowshipNomination
from
.models
import
College
,
Fellowship
,
FellowshipNomination
def
check_profile_eligibility_for_fellowship
(
profile
):
...
...
@@ -11,12 +11,20 @@ def check_profile_eligibility_for_fellowship(profile):
Requirements:
- Profile has a known acad_field
- There is an active College in the Profile
'
s acad_field
- no current Fellowship exists
- no current FellowshipNomination exists
- no
'
not elected
'
decision in last 2 years
- no invitation was turned down in the last 2 years
"""
blocks
=
[]
if
not
profile
.
acad_field
:
blocks
.
append
(
'
No academic field is specified for this profile.
'
'
Contact EdAdmin or techsupport.
'
)
if
not
College
.
objects
.
filter
(
acad_field
=
profile
.
acad_field
).
exists
():
blocks
.
append
(
'
There is currently no College in {profile.acad_field}.
'
'
Contact EdAdmin or techsupport to get one started.
'
)
if
Fellowship
.
objects
.
active
().
regular_or_senior
().
filter
(
contributor__profile
=
profile
).
exists
():
blocks
.
append
(
'
This Profile is associated to an active Fellowship.
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment