Django FilteredSelectMultiple Bootstrap Widget

I am trying to replicate the widget FilteredSelectMultipleused by admin for django applications. But my widget is very different

My rendered widget

The widget in the admin using django-suit or django_admin_bootstrapped is executed using the bootstrap:

Wdiget rendered in the admin

I define my widget and form carriers .py:

class ProcFTPForm(forms.ModelForm):
      id_archivo = forms.ModelMultipleChoiceField(queryset=Archivo_Descarga.objects.all(),required=True,widget=FilteredSelectMultiple("Archivo",is_stacked=False))
      class Media:
       css = {'all':('/admin/css/widgets.css',),}
       js = ('/admin/jquery.js','/admin/jsi18n/')

      def __init__(self, *args, **kwargs):
          super(ProcFTPForm, self).__init__(*args, **kwargs)
          self.helper = FormHelper()

      class Meta:
            model = Lista_Archivos

And in the template, I call the media as follows:

{{ form.media }}

How can I render a widget FilteredSelectMultiplesimilar to admin widgets. In other words, how can I render this widget using bootstrap .

I am using django-crispy-forms , and other widgets are displayed using bootstrap other than the widgetFilteredSelectMultiple

Any advice

Thanks in advance

+4
1

django-admin-bootstrapped django admin, .. overrides.css. FilteredSelectMultiple css .selector, css, 39 - 119 of overrides.css, , Media :

class Media:
   css = {'all':('/admin/css/widgets.css', 'admin/css/overrides.css'),}
   js = ('/admin/jquery.js','/admin/jsi18n/')

:

<link href="{{ STATIC_URL }}admin/css/overrides.css" type="text/css" rel="stylesheet" />

, .

+2

All Articles