-
Notifications
You must be signed in to change notification settings - Fork 82
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
GET parameters not retrievable in action view #164
Comments
I did an experiment by altering some tests and I saw my GET param go through diff --git a/django_object_actions/tests/test_admin.py b/django_object_actions/tests/test_admin.py
index db6e7da..f358414 100644
--- a/django_object_actions/tests/test_admin.py
+++ b/django_object_actions/tests/test_admin.py
@@ -18,7 +18,9 @@ class CommentTests(LoggedInTestCase):
def test_action_on_a_model_with_uuid_pk_works(self):
comment = CommentFactory()
comment_url = reverse("admin:polls_comment_change", args=(comment.pk,))
- action_url = "/admin/polls/comment/{0}/actions/hodor/".format(comment.pk)
+ action_url = "/admin/polls/comment/{0}/actions/hodor/?hello=foo".format(
+ comment.pk
+ )
# sanity check that url has a uuid
self.assertIn("-", action_url)
response = self.client.get(action_url)
@@ -75,7 +77,7 @@ class ChangeTests(LoggedInTestCase):
self.assertIn("foo", response.context_data)
def test_changelist_action_view(self):
- url = "/admin/polls/choice/actions/delete_all/"
+ url = "/admin/polls/choice/actions/delete_all/?nuke=1"
response = self.client.get(url)
self.assertRedirects(response, "/admin/polls/choice/")
diff --git a/example_project/polls/admin.py b/example_project/polls/admin.py
index 8d784a8..7ff1903 100644
--- a/example_project/polls/admin.py
+++ b/example_project/polls/admin.py
@@ -43,6 +43,7 @@ class ChoiceAdmin(DjangoObjectActions, admin.ModelAdmin):
obj.save()
def delete_all(self, request, queryset):
+ print(request.GET)
self.message_user(request, "just kidding!")
@action(description="0")
@@ -145,6 +146,7 @@ class CommentAdmin(DjangoObjectActions, admin.ModelAdmin):
################
def hodor(self, request, obj):
+ print(request.GET)
if not obj.comment:
# bail because we need a comment
return
So I'll need to find another way to replicate this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GET parameters seem to always return empty when attempting to retrieve them from the action view. For example when I add the parameter 'form1' to the url that maps to my action
http://localhost:8000/admin/form_builder/formdefinition/actions/export_form?form_name=form1
the parameter is removed when I access the request.GET object in the action view. Is it possible to access GET parameters somehow?The text was updated successfully, but these errors were encountered: