Modify a lostitem.

    id: lostitem id
551516
def lostitem_modify_view(request, item_id=None):
    
    if request.method == "POST":
        lostitem = get_object_or_404(LostItem, id=item_id)
        form = LostItemForm(request.POST, instance=lostitem)
        if form.is_valid():
            obj = form.save()
            logger.debug(form.cleaned_data)
            # SAFE HTML
            obj.description = safe_html(obj.description)
            obj.save()
            messages.success(request, "Successfully modified lost item.")
            return redirect("lostitem_view", obj.id)
        else:
            messages.error(request, "Error adding lost item.")
    else:
        lostitem = get_object_or_404(LostItem, id=item_id)
        form = LostItemForm(instance=lostitem)

    context = {"form": form, "action": "modify", "id": item_id, "lostitem": lostitem}
    return render(request, "lostfound/lostitem_form.html", context)
562941
function byIdRefKey(id, ref, key, extra) {
      var text = tiaEJ.getTextByLocKey(key, extra);
      var cmp = this.search.byIdRef(id, ref);
      var resItem = this.search.byText(cmp, text, 'container id: ' + id + ', reference: ' + ref);
      return resItem;
    }
471161
function increaseItemDepth(opts: Options, change: Change): Change {
    const previousItem = getPreviousItem(opts, change.value);
    const currentItem = getCurrentItem(opts, change.value);

    if (!previousItem) {
        return change;
    }

    if (!currentItem) {
        return change;
    }

    // Move the item in the sublist of previous item
    return moveAsSubItem(opts, change, currentItem, previousItem.key);
}
836415
def updateitem(self, key, new_val):
        
        if key not in self._position:
            raise KeyError(key)
        self[key] = new_val
13310
def founditem_modify_view(request, item_id=None):
    
    if request.method == "POST":
        founditem = get_object_or_404(FoundItem, id=item_id)
        form = FoundItemForm(request.POST, instance=founditem)
        if form.is_valid():
            obj = form.save()
            logger.debug(form.cleaned_data)
            # SAFE HTML
            obj.description = safe_html(obj.description)
            obj.save()
            messages.success(request, "Successfully modified found item.")
            return redirect("founditem_view", obj.id)
        else:
            messages.error(request, "Error adding found item.")
    else:
        founditem = get_object_or_404(FoundItem, id=item_id)
        form = FoundItemForm(instance=founditem)

    context = {"form": form, "action": "modify", "id": item_id, "founditem": founditem}
    return render(request, "lostfound/founditem_form.html", context)
601617
def modify_filename_id(filename):
    """"""
    split_filename = os.path.splitext(filename)
    id_num_re = re.compile('(\(\d\))')
    id_num = re.findall(id_num_re, split_filename[-2])
    if id_num:
        new_id_num = int(id_num[-1].lstrip('(').rstrip(')')) + 1

        # Reconstruct filename with incremented id and its extension
        filename = ''.join((re.sub(id_num_re, '({0})'.format(new_id_num),
                                   split_filename[-2]), split_filename[-1]))
    else:
        split_filename = os.path.splitext(filename)

        # Reconstruct filename with new id and its extension
        filename = ''.join(('{0} (2)'.format(split_filename[-2]),
                            split_filename[-1]))
    return filename
1239603
def reload
      raise Couchbase::Error::MissingId, 'missing id attribute' unless @id
      pristine = model.find(@id)
      update_attributes(pristine.attributes)
      @meta[:cas] = pristine.meta[:cas]
      self
    end
574582
public function editCollectionItem($collection_id, $collection_item_id = null)
    {
        $this->setCollectionCollection($collection_id);
        $this->setCollectionCollectionItem($collection_item_id);
        $this->setTitleEditCollectionItem();
        $this->setBreadcrumbEditCollectionItem();

        $this->setData('collection', $this->data_collection);
        $this->setData('collection_item', $this->data_collection_item);
        $this->setData('handler', $this->getHandlerCollectionItem());
        $this->setData('weight', $this->collection_item->getNextWeight($collection_id));

        $this->submitEditCollectionItem();

        $this->setJsEditCollectionItem();
        $this->outputEditCollectionItem();
    }
1255650
def dynamic_content_item_variant_update(self, item_id, id, data, **kwargs):
        ""
        api_path = "/api/v2/dynamic_content/items/{item_id}/variants/{id}.json"
        api_path = api_path.format(item_id=item_id, id=id)
        return self.call(api_path, method="PUT", data=data, **kwargs)
257659
def lostitem_view(request, item_id):
    
    lostitem = get_object_or_404(LostItem, id=item_id)
    return render(request, "itemreg/item_view.html", {"item": lostitem, "type": "lost"})
529908
def _reatach(self):
        """"""
        for item, p, idx in self._detached:
            # The item may have been deleted.
            if self.treeview.exists(item) and self.treeview.exists(p):
                self.treeview.move(item, p, idx)
        self._detached = []
1167424
def add_item(self, item):
        """"""
        _idx = len(self.items)
        self.items.update({"item_" + str(_idx + 1): item})
113510
def modify(self, sort=None, purge=False, done=None, undone=None):
        
        self.model.modifyInPlace(
            sort=self._getPattern(sort),
            purge=purge,
            done=self._getDone(done, undone)
        )
215961
private CmsUUID maybeReplaceFormatter(CmsUUID formatterId) {

        if (m_customReplacements != null) {
            CmsUUID replacement = m_customReplacements.get(formatterId);
            if (replacement != null) {
                return replacement;
            }
        }
        return formatterId;
    }
1284684
def item(ctx, appid, title):
    """"""
    ctx.obj['appid'] = appid
    ctx.obj['title'] = title
1236881
def _on_items_changed(self, change):
        
        if change['type'] != 'container':
            return
        op = change['operation']
        if op == 'append':
            i = len(change['value'])-1
            self.adapter.notifyItemInserted(i)
        elif op == 'insert':
            self.adapter.notifyItemInserted(change['index'])
        elif op in ('pop', '__delitem__'):
            self.adapter.notifyItemRemoved(change['index'])
        elif op == '__setitem__':
            self.adapter.notifyItemChanged(change['index'])
        elif op == 'extend':
            n = len(change['items'])
            i = len(change['value'])-n
            self.adapter.notifyItemRangeInserted(i, n)
        elif op in ('remove', 'reverse', 'sort'):
            # Reset everything for these
            self.adapter.notifyDataSetChanged()
779655
def update(self, d):
        

        # Call __setitem__ for all keys in d
        for key in list(d.keys()):
            self.__setitem__(key, d[key])