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. Redefine admin's change_form template for
required model (it should be located at path 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 - it is form's select element (in your case
it should be a list of track and field events). Probably you have to
change "select#id_app" to "select#id_<field_name>".
And you should implement reload_func function - you can use any jQuery
API, like show(), hide(), etc (http://docs.jquery.com/Effects).
Please notice that you have to put jquery.js to your MEDIA_ROOT.

Also I recommend to read "Django Book" (http://www.djangobook.com/)
and "Django Master Class" tutorial (http://toys.jacobian.org/
presentations/2007/oscon/tutorial/) for learning such kind of tricks.

--~--~---------~--~----~------------~-------~--~----~
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