Anthony,

 

I forgot that the “represent” clause could be in the controller. Yes, it 
works fine, thanks!

 

I was wondering if you could help me with a problem that I’ve been 
submitting for months without getting any reply posts.

 

I’m looking for a best practice example of a way to capture the id of an 
already-existing record that is the result of a search, and create a child 
record for it.

 

I hope that it would be worth it to provide a demo, as it would generally 
benefit all new developers.

 

One idea I had was to use Smartgrid to locate an already-existing record, 
then pass Smartgrid vars from the selected record to Factory to add 
children to that one selected record. The generic “add child” feature of 
Smartgrid is a little too open-ended for users, in that they are not guided 
very specifically. I may be wrong about that, and a nice thing about 
Smartgrid is that user can add infinite multiple children to the parent.

 

Not sure if the Smartgrid-to-Factory concept makes any sense. It could be 
that I don’t know how to customize Smartgrid, for example, when I click on 
the child link, and want to add another child, I get a dropdown of all 
potential parents to choose from, instead of the parent that I came from.  
If a good way of searching for parent and adding children to selection 
could be demonstrated that helps new programmers, I would be willing to 
post it on Slices. 

 

Example:

 

Many people own many dogs. User wants to find an already-existing person 
(parent record) and add a dog (child record) to the owner’s dog list.

 

I would like a demo of searching for people that already exist, and adding 
a child record (dog) to a selected person.

 

If you could find the time for this, it would help me fly through a many 
parts of my project!

 

Thanks,

 

Alex

On Monday, June 10, 2013 8:37:16 PM UTC-7, Anthony wrote:
>
> On Monday, June 10, 2013 12:18:51 PM UTC-4, Alex Glaros wrote:
>
>> The 2nd example, function, gets an error:
>>
>>
>>    - In the controller the function error is: <type 
>>    'exceptions.NameError'> name 'rtid_represent' is not defined
>>    - If I put the function in the model, error is: <type 
>>    'exceptions.SyntaxError'> 'return' outside function (db.py, line 1013)
>>
>> I assume you've got some copy/paste errors. As you can see, the 
> rtid_represent function is defined right before it is assigned as the value 
> of the represent attribute, so it cannot be "not defined" at that point. 
> Likewise, the "return" statement is clearly inside the function. Check for 
> rogue spaces/tabs, etc., and make sure the code is properly in order.
>
> Anthony
>

-- 

--- 
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.


Reply via email to