Some improvements to ResourceType handling

My main goal here was to make teacherreg stop get_or_creating default resource types, since the program creation form already handles those and I think it's more reasonable to be able to delete one without having to set a different default resource types tag for the specific program. I also made some improvements to things that confused me while I was working on it; see the commit messages.

Note: This can potentially cause the resource types form in teacherreg to get reordered from how they were before. If you liked the order before and don't like it after merging this, you can mess with priority_default to fix it. Don't use 0, though, it's a special case somewhere in the code and I haven't bothered to figure out why.