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
> 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
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
>
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
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
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
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 =
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,
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', )
9 matches
Mail list logo