Thanks for the info Anthony...
When I do this:
    Field('slug', compute=lambda row: IS_SLUG()(row.title + "-" + 
str(row.id))[0])

 I get none as a slug...



On Saturday, August 25, 2012 5:53:49 PM UTC-6, Anthony wrote:
>
> Sure, something like that seems fine. Look at what SO does -- for example: 
> http://stackoverflow.com/questions/12050934/web2py-build-forms-in-controller-or-view.
>  
> I think they use the number as the unique record identifier, but also 
> include a slug (which doesn't necessarily have to be unique).
>
> Anthony
>
> On Saturday, August 25, 2012 7:16:50 PM UTC-4, SeamusSeamus wrote:
>>
>> This runs into a problem where if I have two items of the same 'title', 
>> the user will only be linked to the first one that was created. Can I make 
>> it so the slug is a field that I designate? Or make it so the slug adds a 
>> incrementing number such as:
>>     Field('slug', compute=lambda row: IS_SLUG()(row.title *+ row.id*)[0])
>>  I know thats not how you do it, but do you get what I mean? Is there a 
>> better way?
>>
>>
>> On Thursday, August 23, 2012 1:18:16 AM UTC-6, Anthony wrote:
>>>
>>>     links = [lambda ro
>>>> w: A('Details',_href=URL('default','show', args=[row.slug]))]
>>>>     fields = [db.equipment.category, db.equipment.title, 
>>>> db.equipment.price]
>>>>
>>>
>>> You have not included "slug" in your list of fields, so I believe it 
>>> will not be included in the data query. Instead of specifying the list of 
>>> fields, you can set the readable attribute to False for fields you don't 
>>> want displayed (including "slug"). In that case, all fields will be 
>>> included in the query (including "slug"), but only the fields you want to 
>>> show will be visible in the grid.
>>>
>>> Anthony 
>>>
>>

-- 



Reply via email to