Jared Kuolt, el viernes 13 de enero a las 09:30 me escribiste:
> 
> Is the DataController meant to be used as CRUD in application, or is
> it meant only for easy data manipulation?
> 
> I haven't much time to research right now, but I have a couple columns
> that should be edited by the user, whereas others should be filtered.
> Here's an example:
> 
> class Posts(SQLObject):
>     slug = StringCol(alternateID=True, length=255)
>     time = DateTimeCol(default=datetime.now)
>     title = StringCol(length=200)
>     text = StringCol()
> 
> The columns slug and time should not be user-edited, but title and
> text should. I was thinking of a syntax like this:
> 
> class Posts(SQLObject):
>     slug = StringCol(alternateID=True, length=255, userField=False
>                      filterMethod=my.slugify)
>     time = DateTimeCol(default=datetime.now,
>                        userField=False, filterMethod=my.filter)
>     title = StringCol(length=200)
>     text = StringCol()
> 
> The DataController would then be able to build a form simply on the
> title and text only, and run the filters on the form submission. Keep
> in mind that I have barely used DataController and am not up-to-speed
> on the usage. Is there an easier way to do this?

Yo can do that specifying the fields to show to the DataController, see
ticket #278: http://trac.turbogears.org/turbogears/ticket/278

Basically you can do:

    post = DataController(Posts, form_fields=('title', 'text'))

One thing missing is the posibility to add 'actions' to fill the missing
fields (and maybe this is exactly what you need).

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
 .------------------------------------------------------------------------,
  \  GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05 /
   '--------------------------------------------------------------------'
The average person laughs 13 times a day

Reply via email to