Hello!

> I know I shall need a lot of javascript magic.. any hints as to go
> about the django forms, fields and javascript stuff would be much
> appreciated.

You can use jQuery magic. You have to redefine admin change form
template for your model (this file should be named as templates/admin/
<app>/<model>/change_form.html) like this:

{% extends "admin/change_form.html" %}
{% block extrahead %}
{{ block.super }}
    <script type="text/javascript" src="/media.site/js/jquery.js"></
script>
    <script type="text/javascript">
      $(document).ready(function() {
          var app = $('select#id_app');
          var reload_func = function() {
              // Your code goes here
          };
          reload_func();
          app.change(reload_func);
      });
    </script>
{% endblock %}

You can see 'app' variable - you have to change it to your select
field. And implement reload_func logic - like using jQuery effects -
show(), hide() etc.
And don't forget to put jquery.js to your MEDIA_ROOT.

Useful links:
- Django book/Extending Django’s Admin Interface (http://
new.djangobook.com/en/1.0/chapter17/)
- jQuery effects (http://docs.jquery.com/Effects)
- Django Master Class (toys.jacobian.org/presentations/2007/oscon/
tutorial/)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to