mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-11-04 09:57:53 +03:00 
			
		
		
		
	Format
This commit is contained in:
		
							parent
							
								
									02d7100ded
								
							
						
					
					
						commit
						413e5101c1
					
				| 
						 | 
					@ -194,7 +194,7 @@ class DjangoConnectionField(ConnectionField):
 | 
				
			||||||
        enforce_first_or_last,
 | 
					        enforce_first_or_last,
 | 
				
			||||||
        root,
 | 
					        root,
 | 
				
			||||||
        info,
 | 
					        info,
 | 
				
			||||||
        **args
 | 
					        **args,
 | 
				
			||||||
    ):
 | 
					    ):
 | 
				
			||||||
        first = args.get("first")
 | 
					        first = args.get("first")
 | 
				
			||||||
        last = args.get("last")
 | 
					        last = args.get("last")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ class DjangoFilterConnectionField(DjangoConnectionField):
 | 
				
			||||||
        extra_filter_meta=None,
 | 
					        extra_filter_meta=None,
 | 
				
			||||||
        filterset_class=None,
 | 
					        filterset_class=None,
 | 
				
			||||||
        *args,
 | 
					        *args,
 | 
				
			||||||
        **kwargs
 | 
					        **kwargs,
 | 
				
			||||||
    ):
 | 
					    ):
 | 
				
			||||||
        self._fields = fields
 | 
					        self._fields = fields
 | 
				
			||||||
        self._provided_filterset_class = filterset_class
 | 
					        self._provided_filterset_class = filterset_class
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,7 +145,7 @@ def replace_csv_filters(filterset_class):
 | 
				
			||||||
                label=filter_field.label,
 | 
					                label=filter_field.label,
 | 
				
			||||||
                method=filter_field.method,
 | 
					                method=filter_field.method,
 | 
				
			||||||
                exclude=filter_field.exclude,
 | 
					                exclude=filter_field.exclude,
 | 
				
			||||||
                **filter_field.extra
 | 
					                **filter_field.extra,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        elif filter_type == "range":
 | 
					        elif filter_type == "range":
 | 
				
			||||||
            filterset_class.base_filters[name] = RangeFilter(
 | 
					            filterset_class.base_filters[name] = RangeFilter(
 | 
				
			||||||
| 
						 | 
					@ -154,5 +154,5 @@ def replace_csv_filters(filterset_class):
 | 
				
			||||||
                label=filter_field.label,
 | 
					                label=filter_field.label,
 | 
				
			||||||
                method=filter_field.method,
 | 
					                method=filter_field.method,
 | 
				
			||||||
                exclude=filter_field.exclude,
 | 
					                exclude=filter_field.exclude,
 | 
				
			||||||
                **filter_field.extra
 | 
					                **filter_field.extra,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,8 +23,7 @@ def fields_for_form(form, only_fields, exclude_fields):
 | 
				
			||||||
    for name, field in form.fields.items():
 | 
					    for name, field in form.fields.items():
 | 
				
			||||||
        is_not_in_only = only_fields and name not in only_fields
 | 
					        is_not_in_only = only_fields and name not in only_fields
 | 
				
			||||||
        is_excluded = (
 | 
					        is_excluded = (
 | 
				
			||||||
            name
 | 
					            name in exclude_fields  # or
 | 
				
			||||||
            in exclude_fields  # or
 | 
					 | 
				
			||||||
            # name in already_created_fields
 | 
					            # name in already_created_fields
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -81,7 +81,7 @@ class SerializerMutation(ClientIDMutation):
 | 
				
			||||||
        convert_choices_to_enum=True,
 | 
					        convert_choices_to_enum=True,
 | 
				
			||||||
        _meta=None,
 | 
					        _meta=None,
 | 
				
			||||||
        optional_fields=(),
 | 
					        optional_fields=(),
 | 
				
			||||||
        **options
 | 
					        **options,
 | 
				
			||||||
    ):
 | 
					    ):
 | 
				
			||||||
        if not serializer_class:
 | 
					        if not serializer_class:
 | 
				
			||||||
            raise Exception("serializer_class is required for the SerializerMutation")
 | 
					            raise Exception("serializer_class is required for the SerializerMutation")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -275,7 +275,7 @@ def test_perform_mutate_success():
 | 
				
			||||||
    result = MyMethodMutation.mutate_and_get_payload(
 | 
					    result = MyMethodMutation.mutate_and_get_payload(
 | 
				
			||||||
        None,
 | 
					        None,
 | 
				
			||||||
        mock_info(),
 | 
					        mock_info(),
 | 
				
			||||||
        **{"cool_name": "Narf", "last_edited": datetime.date(2020, 1, 4)}
 | 
					        **{"cool_name": "Narf", "last_edited": datetime.date(2020, 1, 4)},
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert result.errors is None
 | 
					    assert result.errors is None
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,10 +102,8 @@ def validate_fields(type_, model, fields, only_fields, exclude_fields):
 | 
				
			||||||
        if name in all_field_names:
 | 
					        if name in all_field_names:
 | 
				
			||||||
            # Field is a custom field
 | 
					            # Field is a custom field
 | 
				
			||||||
            warnings.warn(
 | 
					            warnings.warn(
 | 
				
			||||||
                (
 | 
					                f'Excluding the custom field "{name}" on DjangoObjectType "{type_}" has no effect. '
 | 
				
			||||||
                    'Excluding the custom field "{field_name}" on DjangoObjectType "{type_}" has no effect. '
 | 
					                'Either remove the custom field or remove the field from the "exclude" list.'
 | 
				
			||||||
                    'Either remove the custom field or remove the field from the "exclude" list.'
 | 
					 | 
				
			||||||
                ).format(field_name=name, type_=type_)
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            if not hasattr(model, name):
 | 
					            if not hasattr(model, name):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,7 @@ def graphql_query(
 | 
				
			||||||
            graphql_url,
 | 
					            graphql_url,
 | 
				
			||||||
            json.dumps(body),
 | 
					            json.dumps(body),
 | 
				
			||||||
            content_type="application/json",
 | 
					            content_type="application/json",
 | 
				
			||||||
            **header_params
 | 
					            **header_params,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        resp = client.post(
 | 
					        resp = client.post(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user