Am 02.02.2006 um 21:12 schrieb Kevin Dangoor:

For the column_widget_fk_col and join_widget_related_join, the data is
displayed using unicode(object_ instance), which is ugly.  Maybe it's
just stepping stone, but I think there should be a way to specify a
column to use to display the object.  Maybe something similar to
form_order or somthing defined in sqlmeta like sqlmeta.display_field =
'name'.  I'd like to hear opinions on if and how this would be done.

This was discussed either in a ticket or on the list... Here was the
thinking: just giving a column name isn't good enough. (Consider a
table with last name, first name and middle initial). Of course, you
can use a property instead. But, what I was figuring was that what
we're really angling for when you're displaying that is the
human-understandable form of that particular object. And that's what
__unicode__ or __str__ are all about, right?


One should keep in mind that this isn't quite MVC anymore, as the model now decides over its representation (i.e. view). Of course, if you consider FastData a tool to create a quick&dirty CRUD interface, and not the main user interface of your application that's probably OK.

What would be the "proper" MVC way? In TG, the (kid) templates play the role of the view, so we would need a way for the app to specify a template that renders the object as an xhtml fragment. There could still be a default template, e.g. just "<span xmlns:py='...">$ {object_instance}</span>" would be a good default that happens to give the same result as the current implementation.

ciao
Martina

Reply via email to