dispatch/theme/widgets.py
def save(self, validated_data):
        """Save widget data for this zone."""

        (zone, created) = ZoneModel.objects.get_or_create(zone_id=self.id)

        zone.widget_id = validated_data['widget']
        zone.data = validated_data['data']

        # Call widget before-save hook on nested widgets
        for key in list(zone.data.keys()):
            if isinstance(zone.data[key], dict) and ('id' in zone.data[key].keys()) and ('data' in zone.data[key].keys()):
                zone.data[key]['data'] = self.before_save(zone.data[key]['id'], zone.data[key]['data'])

        # Call widget before-save hook
        zone.data = self.before_save(zone.widget_id, zone.data)

        return zone.save()
def save(self, validated_data):
        """Save widget data for this zone."""

        (zone, created) = ZoneModel.objects.get_or_create(zone_id=self.id)

        zone.widget_id = validated_data['widget']
        zone.data = validated_data['data']

        # Call widget before-save hook on nested widgets
        for key in list(zone.data.keys()):
            if isinstance(zone.data[key], dict) and ('id' in zone.data[key].keys()) and ('data' in zone.data[key].keys()):
                zone.data[key]['data'] = self.before_save(zone.data[key]['id'], zone.data[key]['data'])

        # Call widget before-save hook
        zone.data = self.before_save(zone.widget_id, zone.data)

        return zone.save()
def save ( self , validated_data ) : ( zone , created ) = ZoneModel . objects . get_or_create ( zone_id = self . id ) zone . widget_id = validated_data [ 'widget' ] zone . data = validated_data [ 'data' ] # Call widget before-save hook on nested widgets for key in list ( zone . data . keys ( ) ) : if isinstance ( zone . data [ key ] , dict ) and ( 'id' in zone . data [ key ] . keys ( ) ) and ( 'data' in zone . data [ key ] . keys ( ) ) : zone . data [ key ] [ 'data' ] = self . before_save ( zone . data [ key ] [ 'id' ] , zone . data [ key ] [ 'data' ] ) # Call widget before-save hook zone . data = self . before_save ( zone . widget_id , zone . data ) return zone . save ( )
Save widget data for this zone.
Save widget data for this zone .