Skip to content
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

GenericForeignKeyRawIdWidget with Django 1.11 #68

Open
mikebq opened this issue Feb 25, 2020 · 0 comments
Open

GenericForeignKeyRawIdWidget with Django 1.11 #68

mikebq opened this issue Feb 25, 2020 · 0 comments

Comments

@mikebq
Copy link
Contributor

mikebq commented Feb 25, 2020

I am porting an app to Django 1.11 and found that if I look at individual permissions an error occurs. It comes from GenericForeignKeyRawIdWidget. I have had a look at the code in question and I am trying to get understand what is going on, it seems a little confused: https://github.com/jazzband/django-authority/blob/master/authority/widgets.py#L22-L26 The __init__ method in the class is calling the __init__ method of the base class' base class (so it misses a level of initialisation, which I think is not a good idea). However the parameters for GenericForeignKeyRawIdWidget.__init__ are not sufficient to call ForeignKeyRawIdWidget.__init__.

So essentially for a GET against /authority/permission/21852/change/ using Django 1.11.28 results in an AttributeError: 'GenericForeignKeyRawIdWidget' object has no attribute 'rel'
It blows up in /site-packages/django/contrib/admin/widgets.py in get_context, line 139. However though changing the base class of GenericForeignKeyRawIdWidget to forms.TextInput does prevent this error, but is that the right thing to do?

If anyone has any advice or clues of how to have this behave then thank you in advance :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant