Fixed #21430 -- Warning raised when unpickling Models and QuerySet from different versions

Thanks @charettes @akaariai @loic for help.
put `warnings.warn()` outside the if/else so you don't need to repeat it