Malcolm Tredinnick <malcolm <at> pointy-stick.com> writes: > > documentation). As you have noted, you also then have to do something > with limit_choices_to and possibly a validator to enforce this at the > Python and form validation level, but it's shouldn't be too bad.
Does limit_choices_to work outside of the admin interface? Even within the admin interface, I could not figure out a way to refer, within limit_choices_to, to fields on the record it was to limit for. In other words, I can hard code values in there, but not refer to the value of self.whatever_field. Can limit_choices_to take the name of a function that returns an iterator or something? It would be neat. Also, the validator stuff is in a state of flux, and I have been hesitant to commit much time coding to the current implementation, but that's just me. I ended up adding some Dojo javascript to get the legal values, in this case sub-accounts for a buyer, and populate the html select options when the buyer has been selected. function fill_accounts(evt) { el = document.getElementById("id_buyer"); function results_for_post(type, value, evt) { eval('res='+value); if (res['is_ok']==true) { var account_sel = document.getElementById("id_account"); account_sel.innerHTML = res['html']; } else { alert ("Problem getting info for " + target.value + "."); el.focus(); } } if (el.value != "") { dojo.io.bind({ url: "/admin/manager/participants/"+el.value+"/accounts/?output=json", method: "GET", type: "text/javascript", load: results_for_post, error: function(type, error) { alert("Error getting accounts: " + error); }, }); } return false; } It also makes it so they can not enter an illegal value in this view. Anyway, perhaps the SQLAlchemy branch might someday address this more comprehensively. Peace, David S. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---