Hello everyone,

I'm using FormSet in order to add multiple object at once on
a view. To have a more user friendly approach, I created a
'my.formset.js' file and I need to include a 'jquery.formset.js' lib
to add/remove row of the formset (client side) and edit the
formset management information.

My idea to resolve this problem was to include these two
javascript media file everytime I'm using a formset.

A bit like every media js file for widgets :)

So my first attempt was something like that:
```
class BaseFormSet(BaseInlineFormSet):
    class Media:
        js = ("my.formset.js", "jquery.formset.js", )
```

but this doesnt render these js files with formset.media.render_js().

My second attempt was:
```
formset.media.add_js( ["my.formset.js", "jquery.formset.js", ])
```

My last attempt:
```
form = formset.forms[0]
formset.forms[0].fields[form.fields.keys()[0]].media.add_js(["my.formset.js", "jquery.formset.js", ])
```

Still not working cause the .media._js is regenerating the media js
files.

The only solution so far I have, provided by @tbaxter, is to
include all my js files in all my application, and initialize/use
the formset/widgets javascript only on certain condition.

I don't like the idea of including my js application wide. It's
gonna overload all my pages for nothing (my js files are
completely standalone) when there is no FormSet.

Can I have your tought on this probleme, and what solution
you have in mind?

Thank you,

--
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54DE2006.9030001%40arkade.info.
For more options, visit https://groups.google.com/d/optout.

Reply via email to