'Set the fixed entry for this collection.
The entry must be an instance of one of the related entry classes.  This
method must be called before a relationship is used.  It gets called
either from the constructor (when collections are instantiated from
other resource handling code) or from read_query_parameters() (when a
request is made directly for the collection.'

def _set_fixed_entry(self, entry):

    names = self.related_classes.keys()
    if isinstance(entry, self.related_classes[names[0]]):
        (self.fixed_name, self.unfixed_name) = names
    else:
        assert isinstance(entry, self.related_classes[names[1]])
        (self.unfixed_name, self.fixed_name) = names
    self.fixed_entry = entry
    self.unfixed_class = self.related_classes[self.unfixed_name]
    self.related_manager = self.entry_class._get_related_manager(entry.instance)
