|
27
|
1 |
|
|
|
2 |
from django.db import models |
|
|
3 |
from django.contrib.auth.models import User |
|
|
4 |
|
|
|
5 |
'''class User(models.Model): |
|
|
6 |
name = models.CharField(max_length=200) |
|
|
7 |
password = models.CharField(max_length=200) |
|
|
8 |
|
|
|
9 |
def __unicode__(self): |
|
|
10 |
return self.name''' |
|
|
11 |
|
|
|
12 |
class Image(models.Model): |
|
|
13 |
url = models.CharField(max_length=200) |
|
|
14 |
|
|
|
15 |
def __unicode__(self): |
|
|
16 |
return self.url |
|
|
17 |
|
|
|
18 |
class Document(models.Model): |
|
|
19 |
documentId = models.IntegerField(primary_key=True) |
|
|
20 |
title = models.CharField(max_length=200) |
|
|
21 |
description = models.CharField(max_length=400) |
|
|
22 |
image = models.ForeignKey(Image) |
|
|
23 |
date= models.DateTimeField() |
|
|
24 |
def __unicode__(self): |
|
|
25 |
return str(self.documentId) |
|
|
26 |
|
|
|
27 |
class Documentaryfile(models.Model): |
|
|
28 |
title = models.CharField(max_length=200) |
|
|
29 |
date = models.DateTimeField() |
|
|
30 |
description = models.CharField(max_length=400) |
|
|
31 |
visibility = models.BooleanField(default=False) |
|
37
|
32 |
jsontreemap = models.TextField() |
|
|
33 |
jsonstreamgraph = models.TextField() |
|
|
34 |
image = models.ForeignKey(Image) |
|
|
35 |
user = models.ForeignKey(User) |
|
27
|
36 |
list_concepts = models.TextField() |
|
|
37 |
concepts_with_detailed_documents_list = models.TextField() |
|
|
38 |
|
|
|
39 |
def __unicode__(self): |
|
|
40 |
return str(self.id) |
|
|
41 |
|
|
|
42 |
class Annotationdocument(models.Model): |
|
|
43 |
description = models.CharField(max_length=200) |
|
|
44 |
user = models.ForeignKey(User) |
|
|
45 |
document = models.ForeignKey(Document) |
|
|
46 |
visibility = models.BooleanField() |
|
|
47 |
annoted_text = models.CharField(max_length=200,blank=True,null=True) |
|
|
48 |
annoted_text_page = models.IntegerField(blank=True,null=True) |
|
|
49 |
annoted_text_offset = models.IntegerField(blank=True,null=True) |
|
|
50 |
documentaryfile = models.ForeignKey(Documentaryfile) |
|
|
51 |
def __unicode__(self): |
|
|
52 |
return self.description |
|
|
53 |
|
|
|
54 |
class AnnotationDocumentaryFile(models.Model): |
|
|
55 |
description = models.CharField(max_length=200) |
|
|
56 |
user = models.ForeignKey(User) |
|
|
57 |
documentaryFile = models.ForeignKey(Documentaryfile) |
|
|
58 |
|
|
|
59 |
def __unicode__(self): |
|
|
60 |
return self.description |
|
|
61 |
|
|
|
62 |
class Cluster(models.Model): |
|
|
63 |
title = models.CharField(max_length=200) |
|
|
64 |
description = models.CharField(max_length=400) |
|
|
65 |
weight = models.FloatField() |
|
|
66 |
document = models.ManyToManyField(Document, through="Clusterdocumentweight") |
|
|
67 |
documentaryfile = models.ForeignKey(Documentaryfile) |
|
|
68 |
image = models.ForeignKey(Image) |
|
|
69 |
|
|
|
70 |
def __unicode__(self): |
|
|
71 |
return str(self.id) |
|
|
72 |
|
|
|
73 |
class Annotationcluster(models.Model): |
|
|
74 |
description = models.CharField(max_length=200) |
|
|
75 |
user = models.ForeignKey(User) |
|
|
76 |
cluster = models.OneToOneField(Cluster) |
|
|
77 |
|
|
|
78 |
def __unicode__(self): |
|
|
79 |
return self.description |
|
|
80 |
|
|
|
81 |
class Clusterdocumentweight(models.Model): |
|
|
82 |
document = models.ForeignKey(Document) |
|
|
83 |
cluster = models.ForeignKey(Cluster) |
|
|
84 |
weight = models.FloatField() |
|
|
85 |
|
|
|
86 |
# Le couple cluster/document est unique |
|
|
87 |
class Meta: |
|
|
88 |
unique_together = ( 'cluster', 'document' ) |
|
|
89 |
|
|
|
90 |
class Tag(models.Model): |
|
|
91 |
value = models.CharField(max_length=50) |
|
|
92 |
cluster = models.ForeignKey(Cluster,blank=True,null=True) |
|
|
93 |
annotationcluster = models.ForeignKey(Annotationcluster,blank=True,null=True) |
|
|
94 |
annotationdocument = models.ForeignKey(Annotationdocument,blank=True,null=True) |
|
|
95 |
annotationDocumentaryFile = models.ForeignKey(AnnotationDocumentaryFile,blank=True,null=True) |
|
|
96 |
document = models.ForeignKey(Document,blank=True,null=True) |
|
|
97 |
def __unicode__(self): |
|
|
98 |
return self.value |