Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F79216781
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
Sun, Aug 25, 07:59
Size
5 KB
Mime Type
text/x-python
Expires
Tue, Aug 27, 07:59 (2 d)
Engine
blob
Format
Raw Data
Handle
20163927
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
from
datetime
import
date
from
django.utils.translation
import
gettext
as
_
# test model with essential tables
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
CDROM
=
3
TYPE_CHOICES
=
(
(
PRINT
,
'Print'
),
(
ELECTRONIC
,
'Electronic'
),
(
CDROM
,
'CD-ROM'
),
)
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
)
# 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
)
def
__str__
(
self
):
return
f
"{self.website}"
class
Meta
:
ordering
=
(
'starting_year'
,)
class
Funder
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
300
,
null
=
True
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Meta
:
ordering
=
(
'name'
,)
class
Agreement
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
300
,
null
=
False
)
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
Term
(
models
.
Model
):
version
=
models
.
ManyToManyField
(
Version
)
cost_factor
=
models
.
IntegerField
(
null
=
False
)
embargo_months
=
models
.
IntegerField
(
null
=
False
)
ir_archiving
=
models
.
BooleanField
(
default
=
False
)
licence
=
models
.
IntegerField
(
null
=
False
)
comment
=
models
.
CharField
(
max_length
=
600
,
null
=
True
)
source
=
models
.
URLField
(
max_length
=
600
)
journals
=
models
.
ManyToManyField
(
Journal
)
publishers
=
models
.
ManyToManyField
(
Publisher
)
agreements
=
models
.
ManyToManyField
(
Agreement
)
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
):
term
=
models
.
ManyToManyField
(
Term
)
condition_type
=
models
.
ManyToManyField
(
ConditionType
)
class
OrganizationCondition
(
models
.
Model
):
organization
=
models
.
ManyToManyField
(
Institution
)
condition_set
=
models
.
ManyToManyField
(
ConditionSet
)
valid_from
=
models
.
IntegerField
(
null
=
True
)
valid_until
=
models
.
IntegerField
(
null
=
True
)
class
Meta
:
ordering
=
(
'-valid_from'
,)
Event Timeline
Log In to Comment