Commit 46ddf6e8 authored by Renán Sosa Guillen's avatar Renán Sosa Guillen

save polygon model in db

parent 85265b14
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from catalog.models import State, City
from catalog.models import Polygon
import json, unicodedata
class Command(BaseCommand):
......@@ -14,7 +14,14 @@ class Command(BaseCommand):
for index in range(1,33):
with open(base_path + str(index)+'.geojson') as f:
data = json.load(f)
print "Estado: ", data['name']
# print "Estado: ", data['name']
for feat in data['feature']:
polygon = Polygon(
name = feat['properties']['NOMGEO']
json_info = feat
)
polygon.save()
# print ("============= "+ data['name'] + " ===================")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment