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
c5c63603
Commit
c5c63603
authored
8 years ago
by
Geert Kapteijns
Browse files
Options
Downloads
Patches
Plain Diff
Add additional fields SubmissionFactory
parent
1b10a085
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
SciPost_v1/settings.py
+2
-2
2 additions, 2 deletions
SciPost_v1/settings.py
comments/migrations/0010_auto_20170219_1006.py
+27
-0
27 additions, 0 deletions
comments/migrations/0010_auto_20170219_1006.py
submissions/factories.py
+20
-7
20 additions, 7 deletions
submissions/factories.py
with
49 additions
and
9 deletions
SciPost_v1/settings.py
+
2
−
2
View file @
c5c63603
...
@@ -105,8 +105,8 @@ CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',)
...
@@ -105,8 +105,8 @@ CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',)
SHELL_PLUS_POST_IMPORTS
=
(
SHELL_PLUS_POST_IMPORTS
=
(
(
'
theses.factories
'
,
(
'
ThesisLinkFactory
'
)),
(
'
theses.factories
'
,
(
'
ThesisLinkFactory
'
)),
(
'
comments.factories
'
,
'
CommentFactory
'
),
(
'
comments.factories
'
,
(
'
CommentFactory
'
)
)
,
(
'
submissions.factories
'
,
'
SubmissionFactory
'
),
(
'
submissions.factories
'
,
(
'
SubmissionFactory
'
,
'
EICassignedSubmissionFactory
'
)
),
)
)
MATHJAX_ENABLED
=
True
MATHJAX_ENABLED
=
True
...
...
This diff is collapsed.
Click to expand it.
comments/migrations/0010_auto_20170219_1006.py
0 → 100644
+
27
−
0
View file @
c5c63603
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-02-19 09:06
from
__future__
import
unicode_literals
import
comments.behaviors
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
comments
'
,
'
0009_auto_20170212_2025
'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'
comment
'
,
name
=
'
author
'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'
scipost.Contributor
'
),
),
migrations
.
AlterField
(
model_name
=
'
comment
'
,
name
=
'
file_attachment
'
,
field
=
models
.
FileField
(
blank
=
True
,
upload_to
=
'
uploads/comments/%Y/%m/%d/
'
,
validators
=
[
comments
.
behaviors
.
validate_file_extension
,
comments
.
behaviors
.
validate_max_file_size
]),
),
]
This diff is collapsed.
Click to expand it.
submissions/factories.py
+
20
−
7
View file @
c5c63603
import
factory
import
factory
import
random
import
string
from
scipost.factories
import
ContributorFactory
from
scipost.factories
import
ContributorFactory
...
@@ -9,17 +11,28 @@ class SubmissionFactory(factory.django.DjangoModelFactory):
...
@@ -9,17 +11,28 @@ class SubmissionFactory(factory.django.DjangoModelFactory):
class
Meta
:
class
Meta
:
model
=
Submission
model
=
Submission
author_list
=
factory
.
Faker
(
'
name
'
)
submitted_by
=
factory
.
SubFactory
(
ContributorFactory
)
submitted_by
=
factory
.
SubFactory
(
ContributorFactory
)
submitted_to_journal
=
'
SciPost Physics
'
submitted_to_journal
=
'
SciPost Physics
'
title
=
factory
.
Faker
(
'
bs
'
)
title
=
factory
.
Faker
(
'
bs
'
)
abstract
=
factory
.
Faker
(
'
text
'
)
abstract
=
factory
.
Faker
(
'
text
'
)
arxiv_link
=
factory
.
Faker
(
'
uri
'
)
arxiv_link
=
factory
.
Faker
(
'
uri
'
)
arxiv_identifier_w_vn_nr
=
factory
.
Sequence
(
lambda
n
:
random_arxiv_identifier_with_version_number
())
arxiv_identifier_wo_vn_nr
=
factory
.
LazyAttribute
(
lambda
obj
:
obj
.
arxiv_identifier_w_vn_nr
[
0
:
-
2
])
domain
=
'
E
'
@factory.post_generation
class
EICassignedSubmissionFactory
(
SubmissionFactory
):
def
authors
(
self
,
create
,
extracted
,
**
kwargs
):
status
=
'
EICassigned
'
# Add a single author if factory is invoked with strategy 'create'
editor_in_charge
=
factory
.
SubFactory
(
ContributorFactory
)
if
not
create
:
return
else
:
self
.
authors
.
add
(
ContributorFactory
())
def
random_arxiv_identifier_with_version_number
():
return
random_arxiv_identifier_without_version_number
()
+
"
v0
"
def
random_arxiv_identifier_without_version_number
():
return
random_digits
(
4
)
+
"
.
"
+
random_digits
(
5
)
def
random_digits
(
n
):
return
""
.
join
(
random
.
choice
(
string
.
digits
)
for
_
in
range
(
n
))
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