-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.py
57 lines (48 loc) · 1.53 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from django.db import models
from django.utils import timezone
try:
from plugins import books
except ImportError:
books = None
class ImportedArticle(models.Model):
dump_name = models.CharField(max_length=255, blank=True, null=True)
article = models.ForeignKey(
'submission.Article', blank=True, null=True,
on_delete=models.CASCADE,
)
bepress_id = models.BigIntegerField()
journal = models.ForeignKey(
'journal.Journal',
on_delete=models.CASCADE,
)
started = models.DateTimeField(default=timezone.now)
class Meta:
unique_together = (
("article", "bepress_id", "dump_name"),
)
class ImportedArticleAuthor(models.Model):
article = models.ForeignKey(
"submission.Article", related_name="bepress_importedarticleauthor",
on_delete=models.CASCADE,
)
author = models.ForeignKey(
"core.Account", related_name="bepress_importedarticleauthor",
on_delete=models.CASCADE,
)
class Meta:
unique_together = (("article", "author"),)
if books:
class ImportedChapter(models.Model):
book = models.ForeignKey(
"books.Book",
null=True, blank=True,
on_delete=models.SET_NULL,
)
chapter = models.ForeignKey(
"books.Chapter",
null=True, blank=True,
on_delete=models.SET_NULL,
)
bepress_id = models.PositiveIntegerField()
class Meta:
unique_together = ("book", "chapter", "bepress_id")