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
e648807d
Commit
e648807d
authored
3 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Add some cleaning
parent
4ab21c8b
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
affiliates/forms.py
+13
-0
13 additions, 0 deletions
affiliates/forms.py
affiliates/views.py
+4
-0
4 additions, 0 deletions
affiliates/views.py
with
17 additions
and
0 deletions
affiliates/forms.py
+
13
−
0
View file @
e648807d
...
...
@@ -40,6 +40,19 @@ class AffiliateJournalAddPublicationForm(forms.ModelForm):
self
.
crossref_data
=
None
super
().
__init__
(
*
args
,
**
kwargs
)
def
clean
(
self
,
*
args
,
**
kwargs
):
cleaned_data
=
super
().
clean
(
*
args
,
**
kwargs
)
# Check that the journal specified in the DOI data is
# the same as in the form
print
(
self
.
crossref_data
)
print
(
self
.
cleaned_data
[
'
journal
'
])
if
(
self
.
crossref_data
[
'
journal
'
]
!=
self
.
cleaned_data
[
'
journal
'
].
name
):
raise
forms
.
ValidationError
(
'
The journal specified in the DOI is different.
'
)
return
cleaned_data
def
clean_doi
(
self
):
input_doi
=
self
.
cleaned_data
[
'
doi
'
]
...
...
This diff is collapsed.
Click to expand it.
affiliates/views.py
+
4
−
0
View file @
e648807d
...
...
@@ -2,6 +2,7 @@ __copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__
=
"
AGPL v3
"
from
django.contrib
import
messages
from
django.contrib.auth.models
import
User
from
django.shortcuts
import
get_object_or_404
,
render
,
redirect
from
django.urls
import
reverse
...
...
@@ -61,6 +62,9 @@ def affiliatejournal_add_publication(request, slug):
form
=
AffiliateJournalAddPublicationForm
(
request
.
POST
or
None
)
if
form
.
is_valid
():
form
.
save
()
else
:
for
error_messages
in
form
.
errors
.
values
():
messages
.
warning
(
request
,
*
error_messages
)
return
redirect
(
reverse
(
'
affiliates:journal_detail
'
,
kwargs
=
{
'
slug
'
:
slug
}))
...
...
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