def __init__(self, *args, **kwargs):
     user_class = get_user_model()
     field_names = get_user_field_names(allow_primary_key=True)
     read_only_field_names = get_user_field_names(allow_primary_key=True,
                                                  non_editable=True)
     meta_obj = MetaObj()
     meta_obj.model = user_class
     meta_obj.fields = field_names
     meta_obj.read_only_fields = read_only_field_names
     self.Meta = meta_obj  # pylint: disable=invalid-name
     super().__init__(*args, **kwargs)
Beispiel #2
0
def test_get_user_field_names(kwargs, expected_fields):
    assert set(get_user_field_names(**kwargs)) == expected_fields