Streamweaver wrote:
> This was through a custom form in a public view. I haven't done much
> with admin forms but maybe someone else knows?
>
>
>
> On Sep 4, 4:50 pm, Anthony Simonelli <[email protected]> wrote:
>> Is this within the Admin interface? If so, I'm having a similar
>> problem. I have a model called Request with a FK relationship to an
>> Employee model. Within the Admin interface, when adding a Request,
>> the drop-down of the Employees selection read "Employee Object". This
>> is also the case when listing the Employees. There is no way to
>> distinguish between the employees.
>>
>> How do I change, what I think is called the "string representation" of
>> the object within the Admin interface. Also, is there some sort of
>> naming convention when creating models to get these fields
>> automatically?
>>
>> On Fri, Sep 4, 2009 at 1:26 PM, Streamweaver<[email protected]> wrote:
>>
>>> I had a model that lists an owner with a FK relationship to the Users
>>> table.
>>> When using model form the dropdown for the owner field defaults to the
>>> username.
>>> I'd like to override that to use a users name as the choice portion of
>>> the dropdown sorted by users last name but I'm having trouble thinking
>>> through how to do this.
>>> Can anyone point me to an example of something like this?
Visit ...
http://docs.djangoproject.com/en/dev/intro/tutorial01
... and search in that page for "Wait a minute"
It indicates that you can return whatever string (actually unicode)
representation you want as constructed from the object attributes when
you bring an object via foreign key.
Mike
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---