Prevent sorting in admin

2012-08-15 Thread Timster
Picture the following model and admin: class Section(models.Model): position = models.PositiveIntegerField(editable=False) title = models.CharField(max_length=200) class SectionAdmin(admin.ModelAdmin): list_display = ['title'] ordering = [ 'position'] The position is a column

Re: sorting in /admin

2011-03-22 Thread Jason Culverhouse
> On Tue, Mar 22, 2011 at 5:29 PM, Jason Culverhouse > wrote: > On Mar 22, 2011, at 12:10 PM, Bobby Roberts wrote: > > > how else would you pull in information from another model into the > > current model list view in admin? > > > > > There are some options: > Search

Re: sorting in /admin

2011-03-22 Thread Karen Tracey
On Tue, Mar 22, 2011 at 5:29 PM, Jason Culverhouse wrote: > On Mar 22, 2011, at 12:10 PM, Bobby Roberts wrote: > > > how else would you pull in information from another model into the > > current model list view in admin? > > > > > There are some options: > Search for >

Re: sorting in /admin

2011-03-22 Thread Jason Culverhouse
On Mar 22, 2011, at 12:10 PM, Bobby Roberts wrote: > how else would you pull in information from another model into the > current model list view in admin? > > There are some options: Search for http://www.google.com/search?q=ModelAdmin+__ You'll find

Re: sorting in /admin

2011-03-22 Thread Bobby Roberts
yeah we want it split into first name and last name. That part is working fine... i'm just trying to figure out how to get the column sortable by clicking on the column header. On Mar 22, 3:53 pm, Siara wrote: > Hmm i dont know but if you dont realy need 2 separate

Re: sorting in /admin

2011-03-22 Thread Siara
Hmm i dont know but if you dont realy need 2 separate colums for name and surname you can define in Customer __unicode__ like that: def __unicode__(self): return self.lastName + " " + self.firstName and then in list_diplay = ['CustomerId'], but that solution could give ou another problems On

Re: sorting in /admin

2011-03-22 Thread Bobby Roberts
how else would you pull in information from another model into the current model list view in admin? On Mar 22, 2:41 pm, Siara wrote: > Why are you doing this way ? > The better idea is to make it that way: > > class YourModelAdmin(admin.ModelAdmin): >    model =

Re: sorting in /admin

2011-03-22 Thread Siara
Why are you doing this way ? The better idea is to make it that way: class YourModelAdmin(admin.ModelAdmin): model = YourModel list_display = [ 'firstName', 'lastName' ] admin.site.register(YourModel, YourModelAdmin) and i'm sure then you will be able to sort olums On 22 Mar, 19:28,

sorting in /admin

2011-03-22 Thread Bobby Roberts
I am listing the following fields from the model in /admin as follows: [...snip...] def Client_Lastname(self, obj): return obj.CustomerId.lastName def Client_Firstname(self, obj): return obj.CustomerId.firstName list_display = ('Client_Firstname', 'Client_Lastname', )