{{if equipment:}}
[code to display equipment]
{{pass}}
Anthony
On Thursday, August 30, 2012 1:03:00 AM UTC-4, SeamusSeamus wrote:
>
> Sure...
>
> controller
> .....
> try:
> equipment = db.equipment[int(request.args(0))]
> except:
> equipment = db.equipment(request.args(0)) or db(db.equipment.slug
> == request.args(0)).select().first()
> ....
>
> view:
> {{extend 'layout.html'}}
> <h2>{{=equipment.title}}</h2>
> .....
> .....
> {{=equipment.description}}
> ....
>
> On Wednesday, August 29, 2012 10:59:28 PM UTC-6, Anthony wrote:
>>
>> I think we have to see what your function is returning and what the view
>> is doing with it to answer that one.
>>
>> On Thursday, August 30, 2012 12:02:46 AM UTC-4, SeamusSeamus wrote:
>>>
>>> Hi,
>>> I am passing args from my SQLForm to a page (details.html) which pretty
>>> much shows 'details' about a product.
>>> www.mydomain.com/details/item-name
>>>
>>> If I just go to www.mydomain.com/details I get
>>>
>>> <type 'exceptions.AttributeError'> 'NoneType' object has no attribute
>>> 'title'
>>>
>>>
>>>
>>> I am guessing this is because it is loading a page and because there is
>>> no arguments, there is nothing to pull. I assume a simple if statement
>>> would fix this in the view, right?
>>>
>>>
>>> {{if xxxxxxxx:}
>>>
>>> Show the item details
>>>
>>> {{else:}}
>>>
>>> Show this content
>>>
>>> {{pass}}
>>>
>>>
>>> Would someone be kind enough to show me what would work best to
>>> accomplish this?
>>>
>>> Thanks
>>>
>>>
>>>
>>>
--