| author | ymh <ymh.work@gmail.com> |
| Fri, 19 Jul 2024 09:38:03 +0200 | |
| changeset 704 | b5835dca2624 |
| parent 614 | 40e125004a0b |
| child 693 | 09e00f38d177 |
| permissions | -rw-r--r-- |
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
# -*- coding: utf-8 -*- |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
''' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
Created on Jan 27, 2012 |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
@author: ymh |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
''' |
|
353
91c44b3fd11f
Correcterrors on missing dbpedia informations
ymh <ymh.work@gmail.com>
parents:
279
diff
changeset
|
7 |
from hdabo.models import Tag, Datasheet |
|
91c44b3fd11f
Correcterrors on missing dbpedia informations
ymh <ymh.work@gmail.com>
parents:
279
diff
changeset
|
8 |
from hdalab import fields |
|
91c44b3fd11f
Correcterrors on missing dbpedia informations
ymh <ymh.work@gmail.com>
parents:
279
diff
changeset
|
9 |
|
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
from django.db import models |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
class TagYears(models.Model): |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
|
|
614
40e125004a0b
integrate last changes from mcc + finish 1.8 mig + remove some warning
ymh <ymh.work@gmail.com>
parents:
359
diff
changeset
|
15 |
tag = models.OneToOneField(Tag, related_name="years", blank=False, null=False, db_index=True) |
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
start_year = models.IntegerField(blank=False, null=False, db_index=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
end_year = models.IntegerField(blank=False, null=False, db_index=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
app_label = 'hdalab' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
class TagLinks(models.Model): |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
subject = models.ForeignKey(Tag, blank=False, null=False, db_index=True, related_name="taglinks_subjects") |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
object = models.ForeignKey(Tag, blank=False, null=False, db_index=True, related_name="taglinks_objects") |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
app_label = 'hdalab' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
|
|
122
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
31 |
class Country(models.Model): |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
32 |
|
|
279
177b508612f4
add, configure and correct hdalab to installed apps
cavaliet
parents:
272
diff
changeset
|
33 |
dbpedia_uri = models.URLField(max_length=255, blank=False, null=False, db_index=True, unique=True) |
|
122
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
34 |
|
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
35 |
class Meta: |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
36 |
app_label = 'hdalab' |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
37 |
|
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
38 |
class GeoInclusion(models.Model): |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
39 |
|
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
40 |
tag = models.OneToOneField(Tag, related_name="locatedin", db_index=True) |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
41 |
country = models.ForeignKey(Country, blank=False, null=False, related_name="includes", db_index=True) |
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
app_label = 'hdalab' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
class DbpediaFields(models.Model): |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
|
|
279
177b508612f4
add, configure and correct hdalab to installed apps
cavaliet
parents:
272
diff
changeset
|
48 |
dbpedia_uri = models.URLField(max_length=2048, blank=False, null=False, db_index=True, unique=False) |
|
359
46ad324f6fe4
Correct qery_dbpedia and improve model.
ymh <ymh.work@gmail.com>
parents:
353
diff
changeset
|
49 |
tag = fields.OneToOneField(Tag, db_index=True, related_name="dbpedia_fields", related_default=lambda instance: None) |
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
abstract = models.TextField(blank=True, null=True) |
|
279
177b508612f4
add, configure and correct hdalab to installed apps
cavaliet
parents:
272
diff
changeset
|
51 |
thumbnail = models.URLField(max_length=2048, blank=True, null=True, db_index=False) |
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
label = models.CharField(max_length=2048, unique=False, blank=True, null=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
53 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
54 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
55 |
app_label = 'hdalab' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
56 |
|
| 135 | 57 |
|
58 |
class DbpediaFieldsTranslation(models.Model): |
|
59 |
||
60 |
master = models.ForeignKey(DbpediaFields, blank=False, null=False, db_index=True, related_name="translations") |
|
61 |
language_code = models.CharField(max_length=15, blank=False, null=False, db_index=True) |
|
62 |
label = models.CharField(max_length=2048, unique=False, blank=True, null=False) |
|
63 |
abstract = models.TextField(blank=True, null=True) |
|
|
240
c8627191f2d7
add indication that the labels has been translated, and use sparql requests instead of full n3 download
ymh <ymh.work@gmail.com>
parents:
135
diff
changeset
|
64 |
is_label_translated = models.BooleanField(default=True) |
|
c8627191f2d7
add indication that the labels has been translated, and use sparql requests instead of full n3 download
ymh <ymh.work@gmail.com>
parents:
135
diff
changeset
|
65 |
is_abstract_translated = models.BooleanField(default=True) |
| 135 | 66 |
class Meta: |
67 |
app_label = 'hdalab' |
|
68 |
unique_together = ('master', 'language_code') |
|
69 |
||
70 |
||
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
71 |
class HdaSession(models.Model): |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
72 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
73 |
sessionid = models.CharField(max_length=36, unique=True, blank=False, null=False, db_index=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
74 |
data = models.TextField(blank=True, null=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
75 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
76 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
77 |
app_label = 'hdalab' |
| 123 | 78 |
|
79 |
class InseeCoords(models.Model): |
|
80 |
||
81 |
insee = models.IntegerField(primary_key=True) |
|
82 |
city_name = models.CharField(max_length=255, blank=False, null=False) |
|
83 |
latitude = models.FloatField(blank=False, null=False) |
|
84 |
longitude = models.FloatField(blank=False, null=False) |
|
85 |
||
86 |
class Meta: |
|
87 |
app_label = 'hdalab' |
|
88 |
||
89 |
class DatasheetExtras(models.Model): |
|
90 |
||
91 |
datasheet = models.OneToOneField(Datasheet, related_name="extras", db_index=True) |
|
92 |
insee = models.ForeignKey(InseeCoords, blank=True, null=True, db_index=True) |
|
93 |
||
94 |
class Meta: |
|
95 |
app_label = 'hdalab' |