def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) project = Project.objects.get(pk=settings.SUNLUMO_PROJECT_ID) sl_project = SunlumoProject(project.project_path) context['SL_Project'] = project context['SL_Details'] = json.dumps(sl_project.getDetails()) return context
def parse_project_file(self): sl_project = SunlumoProject(self.project_path) for layer_id, values in sl_project.LAYERS_DATA.items(): layer, created = Layer.objects.update_or_create( layer_id=layer_id, defaults={ 'project_id': self.pk, 'title': values['layer_name'], 'visible': values['visible'], 'layer_type': values['type'] } ) for attribute in sl_project.getAttributesForALayer(layer_id): Attribute.objects.get_or_create( layer_id=layer_id, name=attribute )