Malcolm Tredinnick wrote:
> On Sat, 2006-10-07 at 12:06 +0200, Mario Graziosi wrote:
> [...]
>   
>> Yes: I'm trying to render "notes" contents (and I get them  right), but 
>> I can't get right their relative title (i.e. notes.short_description). 
>> I'm using the standard Admin interfaces, no specific templates.
>>
>> Using the standard Admin interface to list the Persons, I set the 
>> "list_display" attribute, in class Admin, to display username 
>> (attribute), getFullName (method) and notes (method). This is 
>> illustrated in the code snippet below.
>>
>> However, as you can see from the attached screenshot, I get a bad 
>> alignment for the formatted title for getFullName() and notes().
>>
>>     class Person (models.Model):
>>         username = models.CharField(maxlength=40, unique=True)
>>         [...snip...]
>>
>>         class Admin:
>>             [... snip...]
>>             list_display = ("username", "getFullName", "notes")
>>
>>     def getFullName(self):
>>         [... snip...]
>>         return result
>>     getFullName.short_description = "Full Name"
>>
>>     def notes(self):
>>         [...snip...]
>>         return result
>>     notes.short_description = "Notes"
>>     
>
> Hmm. Thanks for the extra information; now we have something to test.
>
> I constructed a small example, similar to yours and only had a
> list_display attribute in the inner Admin class (no other attributes
> there).
>
> I was able to get a short_description field displaying in the right
> place.
>
> So there is something special about your setup that is not covered by
> the fragments you have pasted. Time to start removing little bits and
> pieces and seeing how far you can trim back your model without the
> strange effect going away. For example, if you remove, say, getFullName,
> from the list_display tuple, does the problem go away? If you have the
> notes() method returning a constant string each time, does it go away?
>
> What does the HTML output look like? In my case (where I set
> short_description to be the string "Notes short description"), the head
> of the table looks like the following:
>         
>         <thead>
>         <tr>
>         <th class="sorted ascending">
>         <a href="?ot=desc&amp;o=0">
>         Name
>         </a></th><th>
>         
>         Notes short description
>         </th>
>         </tr>
>         </thead>
>         
> (and it displays correctly, as I mentioned). Anything different in your case?
>
> Sorry, more questions than answers in the above, but your problem
> doesn't appear to be something that appears all the time. Having
> established that, we need to work out where the boundary lies.
>
> Regards,
> Malcolm
>   
Well, that's not an answer but it is a good starting point. I'll try to 
remove pieces of code and when I'll find out the cause I surely post 
back the reason for which that's happening (hoping it will help someone 
else).

Meanwhile, all I can do is to thank for your support.

Mario.



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

Reply via email to