Wow!  That was so easy.  Thanks a lot.

-rm

On Oct 29, 12:50 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> Hello!
>
> > It actually works!  In the admin interface it displays the 'contact'
> > field as a combination of the 'first' and 'last' fields of the
> > contact, which is exactly what I wanted.  But, my question is how did
> > it know to do that?  What if I had wanted it to display the
> > 'login_name' instead, for instance?
>
> It is simply displaying the result of the __str__() method in your
> Contact model.
>
> > The second question is related to the same field.  In the create new
> > 'Away' form, the contact field is shown as a select field, which is
> > great, but the items in it are not sorted.  They are placed in the
> > order in which they are created.  Is there a way to sort the items on
> > that list?
>
> You are nearly there. The ordering attribute of the Admin class in
> your Contact model only applies to queries for the Admin's change-list
> pages [1]_. If you add a Meta class to that model with that same
> ordering field [2]_, it will apply to queries for everything site-wide
> and fix the ordering in your select box. It's a little confusing at
> first since they look exactly the same. :-)
>
>     class Meta:
>         ordering = ('first', 'last')
>
> .. [1]http://www.djangoproject.com/documentation/model-api/#id7
> .. [2]http://www.djangoproject.com/documentation/model-api/#ordering
>
> Cheers!
> - whiteinge


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