-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drag and & not working when rendered using bootstrap_form
template tag
#78
Comments
Hi. It's hard to know what's going on without having any further context. Do you see any errors in the browser's JavaScript console? Which Django/sortedm2m version are you using? The best help for me to debug this would be if you could compile a respository that contains a Django project that demonstrates the issue. |
I'm using I'll try to fix it myself today, otherwise I will create a sample project later on. |
Temporary workaround: from bootstrap3.renderers import FieldRenderer
class Sortedm2mFieldRenderer(FieldRenderer):
def list_to_class(self, html, klass):
return html To be linked in settings.py: BOOTSTRAP3 = {
'form_renderers': {
'default': 'bootstrap3.renderers.FormRenderer',
},
'field_renderers': {
'default': 'bootstrap3.renderers.FieldRenderer',
'sorted-m2m': 'path.to.renderers.Sortedm2mFieldRenderer',
},
} And rendered using: |
@gregmuellegger The only logical solution I can think of is generifying the jquery script to operate on classes instead of tag names so that it's more forgiving if tag name changes. Bootstrap replaces mapping = [
('<ul', '<div'),
('</ul>', '</div>'),
('<li', '<div class="{klass}"'.format(klass=classes)),
('</li>', '</div>'),
] |
Using class names instead of tag names sounds good to me. I'm happy to accept a pull request in that regard if that helps with integration for you. I just want to be sure not to have any bootstrap specific code in sortedm2m |
I'm using
django-bootstrap3==6.2.2
and render my form using{% bootstrap_form form %}
.The resulting widget renders fine, but drag and drop does not work.
I'm including js using
{{ form.media }}
.The text was updated successfully, but these errors were encountered: