def get_item_link(self, item, **kwargs): link_kwargs = {'url':item.get_absolute_url(), 'endpoint':self, 'rel':'item', 'prompt':item.get_prompt(),} link_kwargs.update(kwargs) item_link = Link(**link_kwargs) return item_link
def get_item_storage_link(self, item, **kwargs): link_kwargs = {'url': item.instance.url, 'resource': self, 'prompt': 'Absolute Url', 'rel': 'storage-url', } link_kwargs.update(kwargs) storage_link = Link(**link_kwargs) return storage_link
def prepare_field_value(self, val): #if isinstance(val, File): # if hasattr(val, 'name'): # val = val.name # else: # val = None if isinstance(val, Link): val = Link.get_absolute_url() return val
def get_commit_link(self, item, form_kwargs=None, **kwargs): link_kwargs = {'url':self.get_commit_url(item), 'resource':self, 'on_submit':self.handle_commit_submission, 'method':'POST', 'form_kwargs':form_kwargs, 'prompt':'commit', 'rel':'commit',} commit_link = Link(**link_kwargs) return commit_link
def get_copy_link(self, item, form_kwargs=None, **kwargs): if form_kwargs is None: form_kwargs = {} form_kwargs = self.get_copy_form_kwargs(item, **form_kwargs) link_kwargs = {'url':self.get_copy_url(), 'resource':self, 'on_submit':self.handle_copy_submission, 'method':'POST', 'form_class':self.get_copy_form_class(), 'form_kwargs':form_kwargs, 'prompt':'edit', 'rel':'edit',} update_link = Link(**link_kwargs) return update_link
def prepare_field_value(self, val): val = super(JSON, self).prepare_field_value(val) if isinstance(val, Link): val = Link.get_absolute_url() return val
def prepare_field_value(self, val): val = super(CollectionJSON, self).prepare_field_value(val) if isinstance(val, Link): val = Link.get_absolute_url() return val