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

Reversing problem (getting a string repr of the smalluuid)

Open ffuentese opened this issue 6 years ago • 0 comments

I tried to pass a uuid as a parameter and was unable to do so with something like:

response = self.client.post(django.urls.reverse('app_name:method', args=(obj.uuid,)), data) Returning an error like

django.urls.exceptions.NoReverseMatch: Reverse for 'detail' with arguments '' not found. 1 pattern(s) tried: ['app_name/([0-9a-zA-Z-_]+)/$']

The only way to work around this issue was to get the string representation and slice it to get only the smallUUID.

string = repr(obj.uuid)[11:33]

It's rather ugly

ffuentese avatar Jul 24 '18 02:07 ffuentese