browser get_object_or_404 Browser pk request POST get browser stuff su

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
browser = get_object_or_404( Browser, pk=request.POST.get("browser") )
###
stuff['supported_browsers'] = [ b for b in app.browsers.all() ]
#==>
stuff['supported_browsers'] = [ (b, b.id) for b in app.browsers.all() ]
###
{% for b in supported_browsers %}
...
<input type="hidden" name="browser" value="{{ b }}">
<input type="submit" value='Remove "{{ b }}" web browser support'>
...
{% endfor %}
#=====>
{% for b, pk in supported_browsers %}
...
<input type="hidden" name="browser" value="{{ pk }}">
<input type="submit" value='Remove "{{ b }}" web browser support'>
...
{% endfor %}