10
10
from django .core .exceptions import ValidationError
11
11
from django .contrib .gis .db import models
12
12
from django .dispatch import receiver
13
+ from django .contrib .postgres .fields import JSONField
13
14
from bims .models .boundary import Boundary
14
15
from bims .models .location_type import LocationType
15
16
from bims .utils .cluster import update_cluster_by_site
@@ -28,7 +29,7 @@ class LocationSite(DocumentLinksMixin):
28
29
'{geocontext_collection_key}'
29
30
30
31
name = models .CharField (
31
- max_length = 100 ,
32
+ max_length = 300 ,
32
33
blank = False ,
33
34
)
34
35
site_description = models .CharField (
@@ -62,6 +63,20 @@ class LocationSite(DocumentLinksMixin):
62
63
null = True ,
63
64
blank = True ,
64
65
)
66
+ map_reference = models .CharField (
67
+ null = True ,
68
+ blank = True ,
69
+ max_length = 200
70
+ )
71
+ land_owner_detail = models .TextField (
72
+ null = True ,
73
+ blank = True ,
74
+ )
75
+ river = models .ForeignKey (
76
+ 'sass.River' ,
77
+ null = True ,
78
+ blank = True ,
79
+ )
65
80
66
81
location_context_document = models .TextField (
67
82
verbose_name = 'Document for location context as JSON.' ,
@@ -71,6 +86,12 @@ class LocationSite(DocumentLinksMixin):
71
86
blank = True
72
87
)
73
88
89
+ additional_data = JSONField (
90
+ verbose_name = 'Additional json data' ,
91
+ null = True ,
92
+ blank = True
93
+ )
94
+
74
95
boundary = models .ForeignKey (
75
96
Boundary ,
76
97
help_text = 'This is lowest boundary where location is placed.' ,
@@ -174,7 +195,7 @@ class Meta:
174
195
"""Meta class for project."""
175
196
app_label = 'bims'
176
197
177
- def __str__ (self ):
198
+ def __unicode__ (self ):
178
199
return u'%s' % self .name
179
200
180
201
def save (self , * args , ** kwargs ):
@@ -203,7 +224,6 @@ def location_site_post_save_handler(sender, instance, **kwargs):
203
224
"""
204
225
Update cluster when location site saved
205
226
"""
206
- return
207
227
if not issubclass (sender , LocationSite ):
208
228
return
209
229
update_cluster_by_site (instance )
0 commit comments