Allow @requires_user_profile to decorate classes as well
Review Request #9950 — Created May 16, 2018 and submitted
@requires_user_profileto ensure that the
model has a
get_profilemethod so that unit tests can run across
Django 1.6 (where
User.get_profileexists) and Django 1.7+ (where it
has been removed).
This decorator has been updated to also work for classes. When applied
to a class, it will apply the decorator to all methods in the class that
test_. In other words, it has the same effect as manually
applying the decorator to each test method in the class.
Ran unit tests on Django 1.6.11 and Django 1.8.19.
It's not always safe to iterate modify a dictionary during iteration.