update
This commit is contained in:
@ -142,7 +142,7 @@ class Location(models.Model):
|
||||
geom=models.MultiPointField(srid=4326)
|
||||
|
||||
def __str__(self):
|
||||
return self.location_name
|
||||
return str(self.location_id)
|
||||
|
||||
|
||||
class Location_line(models.Model):
|
||||
@ -419,6 +419,8 @@ def publish_date(sender, instance, created, **kwargs):
|
||||
print("@@@@@@@@@@@@")
|
||||
print(fields[0])
|
||||
print("@@@@@@@@@@@@")
|
||||
if instance.layerof == 1:
|
||||
updateLocation(mdl, fields)
|
||||
if instance.layerof == 2:
|
||||
updateLineTable(mdl, fields)
|
||||
if instance.layerof == 3:
|
||||
@ -427,6 +429,33 @@ def publish_date(sender, instance, created, **kwargs):
|
||||
except Exception as e:
|
||||
print('##################',e)
|
||||
|
||||
|
||||
def updateLocation(mdl, fields):
|
||||
print(f"Updating {fields[0]} - {fields[1]}")
|
||||
print(mdl.objects.filter(location_id = int(fields[0])))
|
||||
print("-------")
|
||||
mdl.objects.filter(location_id = int(fields[0])).update(
|
||||
location_name = fields[1] if len(fields) > 1 else '',
|
||||
category = fields[2] if len(fields) > 1 else '',
|
||||
zip = fields[3] if len(fields) > 1 else '',
|
||||
address = fields[4] if len(fields) > 1 else '',
|
||||
prefecture = fields[5] if len(fields) > 1 else '',
|
||||
area = fields[6] if len(fields) > 1 else '',
|
||||
city = fields[7] if len(fields) > 1 else '',
|
||||
photos = fields[8] if len(fields) > 1 else '',
|
||||
videos = fields[9] if len(fields) > 1 else '',
|
||||
webcontents = fields[10] if len(fields) > 1 else '',
|
||||
status = fields[11] if len(fields) > 1 else '',
|
||||
portal = fields[12] if len(fields) > 1 else '',
|
||||
group = fields[13] if len(fields) > 1 else '',
|
||||
phone = fields[14] if len(fields) > 1 else '',
|
||||
fax = fields[15] if len(fields) > 1 else '',
|
||||
email = fields[16] if len(fields) > 1 else '',
|
||||
facility = fields[17] if len(fields) > 1 else '',
|
||||
remark = fields[18] if len(fields) > 1 else '',
|
||||
parammeters = fields[19] if len(fields) > 1 else '',
|
||||
tags = fields[20] if len(fields) > 1 else ''
|
||||
)
|
||||
|
||||
def updateLineTable(mdl, fields):
|
||||
print(f"Updating {fields[0]} - {fields[1]}")
|
||||
|
||||
Reference in New Issue
Block a user