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
8baa760d
Commit
8baa760d
authored
6 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Auto-map to Profile when creating a RegistrationInvitation
parent
8b2a9578
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
invitations/forms.py
+12
-0
12 additions, 0 deletions
invitations/forms.py
with
12 additions
and
0 deletions
invitations/forms.py
+
12
−
0
View file @
8baa760d
...
...
@@ -13,6 +13,8 @@ from submissions.models import Submission
from
.
import
constants
from
.models
import
RegistrationInvitation
,
CitationNotification
from
profiles.models
import
Profile
from
ajax_select.fields
import
AutoCompleteSelectField
,
AutoCompleteSelectMultipleField
...
...
@@ -193,6 +195,7 @@ class RegistrationInvitationForm(AcceptRequestMixin, forms.ModelForm):
class
Meta
:
model
=
RegistrationInvitation
fields
=
(
'
profile
'
,
'
title
'
,
'
first_name
'
,
'
last_name
'
,
...
...
@@ -200,6 +203,9 @@ class RegistrationInvitationForm(AcceptRequestMixin, forms.ModelForm):
'
message_style
'
,
'
invitation_type
'
,
'
personal_message
'
)
widgets
=
{
'
profile
'
:
forms
.
HiddenInput
(),
}
def
__init__
(
self
,
*
args
,
**
kwargs
):
# Find Submissions/Publications related to the invitation and fill the autocomplete fields
...
...
@@ -232,6 +238,12 @@ class RegistrationInvitationForm(AcceptRequestMixin, forms.ModelForm):
def
save
(
self
,
*
args
,
**
kwargs
):
if
not
hasattr
(
self
.
instance
,
'
created_by
'
):
self
.
instance
.
created_by
=
self
.
request
.
user
# Try to associate an existing Profile to invitation:
profile
=
Profile
.
objects
.
get_unique_from_email_or_None
(
email
=
self
.
cleaned_data
[
'
email
'
])
self
.
instance
.
profile
=
profile
invitation
=
super
().
save
(
*
args
,
**
kwargs
)
if
kwargs
.
get
(
'
commit
'
,
True
):
# Save the Submission notifications
...
...
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