drf-forms / drf-schema-adapter

Making using Django with frontend libraries and frameworks DRYer
http://drf-schema-adapter.readthedocs.io/en/latest/
MIT License
157 stars 40 forks source link

TypeError: register() got an unexpected keyword argument 'base_name' #57

Closed zvyn closed 4 years ago

zvyn commented 4 years ago

Currently running ./test.sh fails with the following error:

TypeError: register() got an unexpected keyword argument 'base_name'

The reason is this change in the Django REST Framework released in version 3.9.0: "Deprecate the Router.register base_name argument in favor of basename" -- Release Notes

I'd propose the following fix for now:

If that sounds good to you I can try to come up with a patch!

matiassimon commented 4 years ago

I am having the same error trying to follow this cookbook with Python 3.7, Django 3.0 and DRF 3.11. I dont understand why the compatibility matrix says that DRF 3.10 is ok when this change is in DRF 3.9.

nanuxbe commented 4 years ago

As far as I can tell, this change appeared in the documentation of DRF 3.9 but was effective only starting 3.10

Anyway, this has been fixed in release 2.0.7 (https://github.com/drf-forms/drf-schema-adapter/commit/a6c7bc07c62d96fa6680a009f79b9af8359bb93b)

Thanks both of you for the feedback

B3ns44d commented 3 years ago

From the release notes of Django RestFramework and DRF 3.9 announcement they mentioned that

Deprecate the Router.register base_name argument in favor of basename. #5990

Which means, the argument base_name is no longer available from DRF=3.11 onwards and use basename instead

So, Change your router config as,

router.register(r'musician', MusicianViewset, basename='musician')
router.register(r'album', AlbumViewset, basename='album')
longhakly commented 3 years ago

Thank you, it works now.

Note:just change the base_name -> basename