Made virtual_only consistent in contribute_to_class

Fixes #21940 with `**kwargs` (https://code.djangoproject.com/ticket/21940).