Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F69519160
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
Tue, Jul 2, 04:24
Size
4 KB
Mime Type
text/x-python
Expires
Thu, Jul 4, 04:24 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18670781
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
=
False
,
default
=
'unknown'
)
iso_code
=
models
.
CharField
(
max_length
=
3
,
null
=
False
,
default
=
'unknown'
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Meta
:
ordering
=
(
'name'
,)
class
City
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
120
,
null
=
False
,
default
=
'unknown'
)
iso_code
=
models
.
CharField
(
max_length
=
3
,
null
=
False
,
default
=
'unknown'
)
state
=
models
.
CharField
(
max_length
=
3
,
null
=
False
,
default
=
'unknown'
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Meta
:
ordering
=
(
'name'
,)
class
Language
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
120
,
null
=
False
,
default
=
'unknown'
)
iso_code
=
models
.
CharField
(
max_length
=
3
,
null
=
False
,
default
=
'unknown'
)
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'
),
)
nbr
=
models
.
CharField
(
max_length
=
9
,
null
=
False
)
journal
=
models
.
ManyToManyField
(
"Journal"
)
# search journal with ISSN
type_list
=
models
.
CharField
(
choices
=
TYPE_CHOICES
,
max_length
=
10
,
blank
=
True
)
def
__str__
(
self
):
return
f
"{self.nbr} for {self.type_list}"
class
Meta
:
ordering
=
(
'nbr'
,)
class
Oa
(
models
.
Model
):
status
=
models
.
CharField
(
max_length
=
1000
,
null
=
False
,
default
=
'unknown'
)
description
=
models
.
CharField
(
max_length
=
1000
,
null
=
False
,
default
=
'unknown'
)
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
=
False
,
default
=
'unknown'
)
# city = models.ManyToManyField("City")
city
=
models
.
CharField
(
max_length
=
100
,
null
=
False
,
default
=
'unknown'
)
state
=
models
.
CharField
(
max_length
=
3
,
null
=
True
)
country
=
models
.
ManyToManyField
(
"Country"
)
starting_year
=
models
.
PositiveIntegerField
()
website
=
models
.
URLField
(
max_length
=
1000
)
oa_policies_url
=
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
=
1000
,
null
=
False
)
# search journal with name
name_short_iso_4
=
models
.
CharField
(
max_length
=
300
,
null
=
False
)
publisher
=
models
.
ManyToManyField
(
Publisher
)
website
=
models
.
URLField
(
max_length
=
300
)
# issn = models.ManyToManyField("Issn") # search journal with ISSN
oa_options_url
=
models
.
URLField
(
max_length
=
1000
)
oa_status
=
models
.
ForeignKey
(
"Oa"
,
on_delete
=
models
.
CASCADE
)
starting_year
=
models
.
PositiveIntegerField
()
def
__str__
(
self
):
return
f
"{self.name} from {self.website}"
class
Meta
:
ordering
=
(
'name'
,)
class
Institution
(
models
.
Model
):
name_en
=
models
.
CharField
(
max_length
=
1000
,
null
=
True
)
name_en_short
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
name_de
=
models
.
CharField
(
max_length
=
1000
,
null
=
True
)
name_de_short
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
name_fr
=
models
.
CharField
(
max_length
=
1000
,
null
=
True
)
name_fr_short
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
name_it
=
models
.
CharField
(
max_length
=
1000
,
null
=
True
)
name_it_short
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
website
=
models
.
URLField
(
max_length
=
300
)
country
=
models
.
ManyToManyField
(
"Country"
)
starting_year
=
models
.
PositiveIntegerField
(
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
=
False
)
def
__str__
(
self
):
return
f
"{self.name}"
class
Meta
:
ordering
=
(
'name'
,)
class
Condition
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
300
,
null
=
False
)
validity
=
models
.
DateField
(
_
(
"Date"
),
default
=
date
.
today
)
# add today for testing purpose
journal
=
models
.
ManyToManyField
(
Journal
)
funder
=
models
.
ManyToManyField
(
Funder
)
institution
=
models
.
ManyToManyField
(
Institution
)
class
Meta
:
ordering
=
(
'-validity'
,)
def
__str__
(
self
):
return
f
"{self.name}"
Event Timeline
Log In to Comment