-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with new 2.3 release #13
Comments
For your point #1 - It was a recently change that I authored as a part of Issue#11 which was fixed in [PR#12] #12. Is there a good way to find the related name of the reverse relationship without the related_name attribute? If yes, they this probably should be fixed. For point #2, yes that the purpose of the fix in Issue#11. I don't see why now and what security issues it could bring about - Django admin allows that workflow as well, but I agree that there should be a way of removing such reverse fields from the mutation and I thought the 'exclude' option would just work? Can you give that a go? |
while
Just to be clear - the functionality you added is really very useful just my point is that maybe it shouldn't be included by default but by adding it to @bellini666 what are your ideas? |
I understand your points and agree with you, specially when comparing this lib to DRF and django-admin alone. But on the other hand, when we consider So, there's the dilemma now. I would say that I'm more inclined to force the user to have to declare the field, but that makes the mutations behave different from graphene's queries. |
The purpose of the patch wasn't to force the user to define related_name for FK fields, it's just that the current patch has that shortcoming which I think can and should be fixed. On point 2, I agree that maybe there should be a way of turning the auto-generation of indirect fields off. But it should be I would suggest another meta option which enables auto-generation of these reverse fields - say it's called |
@gghildyal I like the idea of having an option for that. I would say that maybe we should create a global option in django settings for that so you would not have to worry about defining your preference, if it is different from the default, in every type you create. What do you think of (as the default): GRAPHENE_DJANGO_PLUS = {
'MUTATIONS_INCLUDE_REVERSE_RELATIONS': True,
} That way if anyone doesn't want the feature he can simply set that to |
@bellini666 @gghildyal
In case that works for us all - I could try to create a PR with such updated logic implementation |
@bellini666 - For me it looks like having support for 'reverse' fields or not does seem like a global option, so I support your recommendation (Although @justinask7 doesn't). @justinask7 The one issue with my approach is that if you have a complex app with loads of models and relationship, doing a per-model configuration can be painful. @justinask7 wrt Option 1 - Can you please give it a go? |
@justinask7 the global option would be for you to change the behaviour of the mutations automatically generating input fields for your reverse relations. If you change this option they would not be automatically generated for you anymore, but you would still be able to add them manually when you choose to do so. And I don't like the idea of having a |
@bellini666 that totally makes sense, cause previously I thought that you were suggesting whether to allow include of reverse fields or not. @gghildyal will include that fix in this PR as well |
Thank you guys for cooperating on this issue! |
As I've installed new 2.3 release I've faces several issues, which firstly I want to bring up for a discussion and upon an approval - I could create a PR for fixing. Issues are as following:
As far as I've debugged - in case FK field does not have
related_name
attribute it's not added asson_set
field either (I think it comes up from this line https://github.com/0soft/graphene-django-plus/blob/master/graphene_django_plus/mutations.py#L97). I believe this can bring a very big confuse as Django does not force you to putrelated_name
attribute2. Basically now by default related son objects can be assigned to
Father
(following the previous example) while you wouldn't even think about that since it's not directly in the model when creating a mutation, right?I believe this might bring some logic-related security issues for some projects. What I'd suggest is that this possibility is really great, but I'd expect that to be added only when I explicitly add related_name in fields of mutation:What are your ideas about that?
The text was updated successfully, but these errors were encountered: