Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91728525
models.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 13, 22:05
Size
6 KB
Mime Type
text/x-python
Expires
Fri, Nov 15, 22:05 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22315410
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
models.py
View Options
from
django.db
import
models
from
django.contrib.auth.models
import
User
import
datetime
from
django.utils.translation
import
gettext
as
_
# Ref: database_model_20210421_MB.drawio 21.04.2021
class
Country
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
120
,
null
=
True
)
iso_code
=
models
.
CharField
(
max_length
=
3
,
null
=
True
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Meta
:
ordering
=
(
'name'
,)
class
City
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
120
,
null
=
True
)
iso_code
=
models
.
CharField
(
max_length
=
3
,
null
=
True
)
state
=
models
.
CharField
(
max_length
=
3
,
null
=
True
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Meta
:
ordering
=
(
'name'
,)
class
Language
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
120
,
null
=
True
)
iso_code
=
models
.
CharField
(
max_length
=
3
,
null
=
True
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Meta
:
ordering
=
(
'name'
,)
class
Issn
(
models
.
Model
):
PRINT
=
1
ELECTRONIC
=
2
OTHER
=
3
TYPE_CHOICES
=
(
(
PRINT
,
'Print'
),
(
ELECTRONIC
,
'Electronic'
),
(
OTHER
,
'Other'
),
)
issn
=
models
.
CharField
(
max_length
=
9
,
null
=
False
)
journal
=
models
.
ManyToManyField
(
"Journal"
)
# search journal with ISSN
issn_type
=
models
.
CharField
(
choices
=
TYPE_CHOICES
,
max_length
=
10
,
blank
=
True
)
def
__str__
(
self
):
return
f
"{self.issn} for {self.issn_type}"
class
Meta
:
ordering
=
(
'issn'
,)
class
Oa
(
models
.
Model
):
status
=
models
.
CharField
(
max_length
=
1000
,
null
=
True
)
description
=
models
.
CharField
(
max_length
=
1000
,
null
=
True
)
subscription
=
models
.
BooleanField
(
default
=
False
)
accepted_manuscript
=
models
.
BooleanField
(
default
=
False
)
apc
=
models
.
BooleanField
(
default
=
False
)
final_version
=
models
.
BooleanField
(
default
=
False
)
def
__str__
(
self
):
return
f
"{self.status}"
class
Meta
:
ordering
=
(
'-subscription'
,)
class
Publisher
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
1000
,
null
=
True
)
# city = models.ManyToManyField("City")
city
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
state
=
models
.
CharField
(
max_length
=
3
,
null
=
True
)
country
=
models
.
ManyToManyField
(
"Country"
)
starting_year
=
models
.
IntegerField
()
website
=
models
.
URLField
(
max_length
=
1000
)
oa_policies
=
models
.
URLField
(
max_length
=
1000
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Meta
:
ordering
=
(
'name'
,)
class
Journal
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
800
,
null
=
True
)
# search journal with name
name_short_iso_4
=
models
.
CharField
(
max_length
=
300
,
null
=
True
)
publisher
=
models
.
ManyToManyField
(
Publisher
)
website
=
models
.
URLField
(
max_length
=
300
)
language
=
models
.
ManyToManyField
(
Language
)
# issn = models.ManyToManyField("Issn") # search journal with ISSN
oa_options
=
models
.
URLField
(
max_length
=
1000
)
oa_status
=
models
.
ForeignKey
(
"Oa"
,
on_delete
=
models
.
CASCADE
)
starting_year
=
models
.
IntegerField
()
def
__str__
(
self
):
return
f
"{self.name} from {self.website}"
class
Meta
:
ordering
=
(
'name'
,)
class
Institution
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
600
,
null
=
True
)
website
=
models
.
URLField
(
max_length
=
600
)
country
=
models
.
ManyToManyField
(
"Country"
)
starting_year
=
models
.
IntegerField
(
null
=
True
)
is_funder
=
models
.
BooleanField
(
default
=
False
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Meta
:
ordering
=
(
'-name'
,)
class
Version
(
models
.
Model
):
description
=
models
.
CharField
(
max_length
=
300
,
null
=
False
)
def
__str__
(
self
):
return
f
"{self.description}"
class
Licence
(
models
.
Model
):
name_or_abbrev
=
models
.
CharField
(
max_length
=
300
,
null
=
False
)
website
=
models
.
URLField
(
max_length
=
600
,
null
=
True
)
def
__str__
(
self
):
return
f
"{self.name_or_abbrev}"
class
Cost_factor_type
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
300
,
null
=
False
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Cost_factor
(
models
.
Model
):
cost_factor_type
=
models
.
ManyToManyField
(
Cost_factor_type
)
amount
=
models
.
IntegerField
(
null
=
False
)
symbol
=
models
.
CharField
(
max_length
=
10
,
null
=
False
)
comment
=
models
.
CharField
(
max_length
=
120
,
default
=
""
)
def
__str__
(
self
):
return
f
"{self.amount} {self.symbol}"
class
Term
(
models
.
Model
):
version
=
models
.
ManyToManyField
(
Version
)
cost_factor
=
models
.
ManyToManyField
(
Cost_factor
)
embargo_months
=
models
.
IntegerField
(
null
=
False
)
ir_archiving
=
models
.
BooleanField
(
default
=
False
)
licence
=
models
.
ManyToManyField
(
Licence
)
comment
=
models
.
CharField
(
max_length
=
600
,
null
=
True
)
source
=
models
.
URLField
(
max_length
=
600
,
null
=
True
)
class
ConditionType
(
models
.
Model
):
condition_issuer
=
models
.
CharField
(
max_length
=
300
,
null
=
False
)
def
__str__
(
self
):
return
f
"{self.condition_issuer}"
class
ConditionSet
(
models
.
Model
):
condition_type
=
models
.
ForeignKey
(
ConditionType
,
on_delete
=
models
.
CASCADE
,
blank
=
True
,
null
=
True
)
organization
=
models
.
ManyToManyField
(
Institution
,
through
=
'OrganizationCondition'
,
through_fields
=
(
'condition_set'
,
'organization'
)
)
journal
=
models
.
ManyToManyField
(
Journal
,
through
=
'JournalCondition'
,
through_fields
=
(
'condition_set'
,
'journal'
)
)
term
=
models
.
ManyToManyField
(
Term
)
comment
=
models
.
CharField
(
max_length
=
100
,
null
=
True
,
default
=
":-)"
)
def
__str__
(
self
):
return
f
"{self.pk} {self.condition_type}|{self.comment}"
class
OrganizationCondition
(
models
.
Model
):
organization
=
models
.
ForeignKey
(
Institution
,
on_delete
=
models
.
CASCADE
,
blank
=
True
,
null
=
True
)
condition_set
=
models
.
ForeignKey
(
ConditionSet
,
on_delete
=
models
.
CASCADE
,
blank
=
True
,
null
=
True
)
valid_from
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
valid_until
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
f
"{self.pk} {self.organization}/{self.condition_set}"
class
JournalCondition
(
models
.
Model
):
journal
=
models
.
ForeignKey
(
Journal
,
on_delete
=
models
.
CASCADE
,
blank
=
True
,
null
=
True
)
condition_set
=
models
.
ForeignKey
(
ConditionSet
,
on_delete
=
models
.
CASCADE
,
blank
=
True
,
null
=
True
)
valid_from
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
valid_until
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
f
"{self.pk} {self.journal.name}/{self.condition_set}"
Event Timeline
Log In to Comment