def get_links(self): return_data = OrderedDict() self_link = self.get_url('self', self.self_link_view_name, self.kwargs, self.request) related_kwargs = {self.lookup_field: self.kwargs.get(self.lookup_field)} related_link = self.get_url('related', self.related_link_view_name, related_kwargs, self.request) if self_link: return_data.update({'self': self_link}) if related_link: return_data.update({'related': related_link}) return return_data