Wednesday, September 26, 2018

Re: what's args parameter in reverse()

args should be a list or a tuple, although is not specified clearly in the docs:
https://docs.djangoproject.com/en/1.11/ref/urlresolvers/#reverse

def test_post_update_view(self):
        response = self.client.post(reverse('post_edit',args=['1']),{
        'title':'Updated title',
        'body':'Updated text',
        })

L

Il giorno mercoledì 26 settembre 2018 14:53:54 UTC+2, Gear Crew ha scritto:

what's the useful form args=''1" here and why use 1 not anything else 
def test_post_update_view(self):
        response = self.client.post(reverse('post_edit',args='1'),{
        'title':'Updated title',
        'body':'Updated text',
        })Enter code here...


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a5524b61-821c-4fd5-ab4f-483de638eedc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment