def previous(self):
        ''' Returns previous image for same content_object and None if image
        is the first. '''
        try:
            return self.__class__.objects.for_model(self.content_object,
                                                    self.content_type).\
                            filter(order__gt=self.order).order_by('order')[0]
        except IndexError:
            return None
def previous ( self ) : try : return self . __class__ . objects . for_model ( self . content_object , self . content_type ) . filter ( order__gt = self . order ) . order_by ( 'order' ) [ 0 ] except IndexError : return None
Returns previous image for same content_object and None if image
        is the first.