django-secretballot icon indicating copy to clipboard operation
django-secretballot copied to clipboard

What is the best way to integrate secretballot with DRF ?

Open AdrienLemaire opened this issue 5 years ago • 2 comments

I have a Django Rest Framework api, and integrated secretballot with one of my models.

I see that django-secretballot auto-generated some views

$ docker exec -ti $(docker ps |grep 'backend'|awk '{print $1}') ./manage.py show_urls | grep vote
/secretballot/vote/     django.contrib.admin.options.changelist_view  admin:secretballot_vote_changelist
/secretballot/vote/<path:object_id>/    django.views.generic.base.RedirectView
/secretballot/vote/<path:object_id>/change/     django.contrib.admin.options.change_view       admin:secretballot_vote_change                                                                                                   
/secretballot/vote/<path:object_id>/delete/     django.contrib.admin.options.delete_view       admin:secretballot_vote_delete                                                                                                   
/secretballot/vote/<path:object_id>/history/    django.contrib.admin.options.history_view      admin:secretballot_vote_history                                                                                                  
/secretballot/vote/add/ django.contrib.admin.options.add_view   admin:secretballot_vote_add
/secretballot/vote/autocomplete/        django.contrib.admin.options.autocomplete_view admin:secretballot_vote_autocomplete

But we only make public our api (all urls starting with /api/), and I'd like a format that is more aligned to DRF standards. @jamesturk have you already used DRF before ? if yes, do you have any suggestion for a solution more tightly coupled with DRF ? Other projects have a viewset or serializer available to make it DRF-compatible.

AdrienLemaire avatar Oct 10 '18 03:10 AdrienLemaire

I haven't used DRF with this project, but if you are interested in writing some helpers to make the project more DRF-compatible I'd be glad to take a look

On Tue, Oct 9, 2018 at 11:53 PM Adrien Lemaire [email protected] wrote:

I have a Django Rest Framework api, and integrated secretballot with one of my models.

I see that django-secretballot auto-generated some views

$ docker exec -ti $(docker ps |grep 'backend'|awk '{print $1}') ./manage.py show_urls | grep vote /secretballot/vote/ django.contrib.admin.options.changelist_view admin:secretballot_vote_changelist /secretballot/vote/path:object_id/ django.views.generic.base.RedirectView /secretballot/vote/path:object_id/change/ django.contrib.admin.options.change_view admin:secretballot_vote_change /secretballot/vote/path:object_id/delete/ django.contrib.admin.options.delete_view admin:secretballot_vote_delete /secretballot/vote/path:object_id/history/ django.contrib.admin.options.history_view admin:secretballot_vote_history /secretballot/vote/add/ django.contrib.admin.options.add_view admin:secretballot_vote_add /secretballot/vote/autocomplete/ django.contrib.admin.options.autocomplete_view admin:secretballot_vote_autocomplete

But we only make public our api (all urls starting with /api/), and I'd like a format that is more aligned to DRF standards. @jamesturk https://github.com/jamesturk have you already used DRF before ? if yes, do you have any suggestion for a solution more tightly coupled with DRF ? Other projects have a viewset or serializer available to make it DRF-compatible.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jamesturk/django-secretballot/issues/52, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAfYuOUHfVvyu9bms5vOjM9YvjiS57iks5ujW82gaJpZM4XUh1Y .

jamesturk avatar Oct 10 '18 13:10 jamesturk

@AdrienLemaire will be done in upcoming 2.0.1

bashu avatar Nov 29 '20 05:11 bashu