Hello,
I tried to use Django's FilterSelectMultiple Widget. But it does not render 
the right list box. Any help would be appreciated.

Thanks 

Here is my code:

forms.py

class appForm(ModelForm):
port = forms.ModelMultipleChoiceField(internalapp.objects.all(),widget=
FilteredSelectMultiple("Port",False,attrs={'rows':'10'}))
class Meta:
model = internalapp
fields = '__all__'
class Media:
css = {'all': ('/static/admin/css/widgets.css',), }
js = ('/admin/jsi18n/',)

views.py
def testhome(request):
submitted = False
if request.method == 'POST' :
form = appForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('/testhome/?submitted=True')
else:
form = appForm()

if 'submitted' in request.GET:
submitted = True
return render(request, 'tryout/testhome.html', {'form': form, 'submitted': 
submitted})

templates
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> 
<title>Document</title>
</head>
<body>
{{ form.media }}
<form>
<table>
{{form.ports }}
</table>
</form>
</body>
</html>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/56f358ec-68d6-46d1-a009-381d65365694%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to