FilterSelectMultiple Widget's right list box does not render

23 views
Skip to first unread message

Yeashin Rabbi

unread,
Jul 2, 2019, 9:34:30 PM7/2/19
to Django users
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>

Zanii Mirzaa

unread,
Jun 9, 2020, 8:36:37 AM6/9/20
to Django users
i have same problem i cant figure out the solution i am new to django and web programming also....
My console error is  :
VM328 SelectFilter2.js:246 Uncaught ReferenceError: grp is not defined
    at VM328 SelectFilter2.js:246
(anonymous) @ VM328 SelectFilter2.js:246
SelectBox.js:144 Uncaught ReferenceError: grp is not defined
    at VM327 SelectBox.js:144
(anonymous) @ SelectBox.js:144
SelectFilter2.js:246 Uncaught ReferenceError: grp is not defined
    at VM328 SelectFilter2.js:246

Cant get rid of it someone aware of this problem plz help.. i am a student a this is my final year project.
Reply all
Reply to author
Forward
0 new messages