I do this all the time

def edit():
   return dict(form=crud.update(db.mytable,request.args(0)))

when called with http://...edit is just creates and when with ..edit/
<n> it goes into update mode.

On Dec 12, 5:25 pm, Carlos <[email protected]> wrote:
> Hi,
>
> I'm implementing crud functions for my models, and I'm wondering if
> it's a good idea for each table to just have one single [edit]
> function instead of two separate [create] and [update] functions?.
>
> This way I will internally search for the arg (record to be edited),
> which if absent then it's treated as [create], otherwise (if present)
> then it's treated as [update].
>
> Is this a good practice?.
>
> Thanks,
>
>    Carlos

Reply via email to