In one of my forms i send two bits of information like this:
<input type ="hidden" name= "items" value="{{item.pk}} {{item.name}}">
when I get the information with request.POST.get, I get "202 book".
How can I seperate just the number from the string or just the word? I did a split:
pks = request.POST.getlist("items")
for pk in pks:
pk.split(' ',1)
but the number isn't always a 1 or 2 digit number, it may be 2 or 3 etc. Also I might have the situations where the name is book1 so I would need that last "1" to remain.
Any ideas how I may go about this?
202 book,book1or something very similar you can use regex and\d+