On Jun 17, 3:52 am, DaveB <[email protected]> wrote: > I have what must be a common problem: there are three master files, > and a transaction in my admin site involves selecting an item from > each of these files. The field in the Transaction table is a foreign > key pointer to the master file's record. The default admin display > condition in the add/change form is that the dropdown boxes for > selecting the master file items only show an ugly "<tablename> object" > label that is the same for all the choices so the user doesn't know > which to select. The field in the Transaction table is a foreign key > pointing to Person, for example, so the admin is not displaying data > from the Person record referenced by the choice in the dropdown > selection, it only shows that the choice is a Person object. I want a > master table field value for each of the choices to be displayed, e.g. > the value for Person.name, instead of "Person object". What's the way > to make this happen? I've tracked the code that generates the drop- > down html <option> tag to mysite/templates/admin/edit_inline/ > fieldset.html, line 12: ... {{ field.label_tag }}{{ field.field }} > where field is an item in "line" which is an item in "fieldset" . I've > tried a bunch of different ways to use fieldsets = [...] in > TransactionAdmin(admin.ModelAdmin) but I keep getting errors that > claim my fields are not valid fields, although they are clearly > defined in models.py and work fine otherwise when I remove the > "fieldset= line[]". I have tried using raw_id_fields but this has no > apparent effect, presumably because it's for list_displays not add/ > change forms. > So, what's the right way to do this? > Thanks for helping me! > -Dave >
Your question is very difficult to read - needs paragraphs. But I think the answer to your problem is to define a __unicode__ method on the target model. -- DR. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

