Thanks Eduardo, it worked!
On Saturday, November 23, 2013 9:26:17 AM UTC-5, Eduardo Cruz wrote:
>
> You are using 'animals' in the for loop not *livestock_animal*s,
> instead of *livestock_animals* use animals like {{=animals.eartag_number}}
> On Sat, 2013-11-23 at 06:18 -0800, raferbop wrote:
>
> # Model
>
> db.define_table('livestock_animals',
>
> Field('eartag_number'),
>
> Field('retagged_number'),
>
> Field('dob', 'date'),
>
> Field('breed', db.breed),
>
> Field('sex', db.sex),
>
> Field('dam'),
>
> Field('sire'),
>
> Field('herd', db.livestock_herd),
>
> Field('proprietor', db.ownership),
>
> auth.signature)
>
>
> # Controller
>
> @auth.requires_login()
>
> def livestock_animals():
>
> form = crud.create(db.livestock_animals, request.args(0))
>
> return dict(form=form)
>
> @auth.requires_login()
>
> def livestock():
>
> db.livestock_animals.proprietor.default = me
>
> crud.settings.formstyle = 'table2cols'
>
> form = crud.create(db.livestock_animals)
>
> livestock =
> db(db.livestock_animals.created_by==auth.user_id).select(orderby=~db.livestock_animals.created_on,limitby=(0,100))
>
>
> return locals()
>
> #View - default/livestock
>
> {{extend 'layout.html'}}
>
>
>
> {{=form}}
>
>
>
> {{for animals in livestock:}}
>
>
>
> <div>
>
>
>
> {{=(livestock_animals.eartag_number)}}
>
> {{=(livestock_animals.dob)}}
>
> {{=(livestock_animals.breed)}}
>
> {{=(livestock_animals.sex)}}
>
> {{=(livestock_animals.dam)}}
>
> {{=(livestock_animals.sire)}}
>
> {{=(livestock_animals.herd)}}
>
> {{=(livestock_animals.proprietor)}}
>
>
>
> </div>
>
>
>
> {{pass}}
>
>
>
>
>
>
>
> Good day Guys,
>
>
>
> The code above returns the following error;
>
> *<type 'exceptions.NameError'> name 'livestock_animals' is not defined*
>
> but I am not able to figure out why, can someone provide me with some
> advise with respect to what I am doing wrong.
>
>
>
> Kind regards,
>
> Rafer
>
> --
> Resources:
> -
> http://web2py.com<http://www.google.com/url?q=http%3A%2F%2Fweb2py.com&sa=D&sntz=1&usg=AFQjCNE7x6wflFTAQ11b-FhtMwFfvltXeg>
> -
> http://web2py.com/book<http://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbook&sa=D&sntz=1&usg=AFQjCNFAv433a0RL4nfaYxTbZ4cHi4Q78A>(Documentation)
> -
> http://github.com/web2py/web2py<http://www.google.com/url?q=http%3A%2F%2Fgithub.com%2Fweb2py%2Fweb2py&sa=D&sntz=1&usg=AFQjCNHSwgWBkjuiIoo30014e8BB_iCDag>(Source
> code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.