Sorry if my answer was misleading.

Massimo

On Dec 9, 8:43 pm, "Wes James" <[EMAIL PROTECTED]> wrote:
> ok - i had done this based on a Nov 6 answer you had given to me.
>
> For now, I have a temp fix by going in to the data base and inserting
> records with just the id and it works fine now.
>
> I'll need to figure out a way to create the student record from at
> least the t2_person name when they do their registration.
>
> -wj
>
> On Tue, Dec 9, 2008 at 5:06 PM, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > You cannot set id so you cannot give it a default value.
>
> > id is the unique record is assigned by the database.
>
> > You should use a different field name and make the field a reference
> > to t2_person.id.
>
> > Massimo
>
> > On Dec 9, 5:37 pm, "Wes James" <[EMAIL PROTECTED]> wrote:
> >> I have:
>
> >> db.student.id.default=t2.person_id
>
> >> in my db.py
>
> >> but I have a problem.  When a student comes and registers that creates
> >> a t2_person record - fine.  But then they are logged in and they see
> >> their initial form. If they save some data, all is fine, but if they
> >> don't and another student registers, then saves some data then the
> >> student.id gets out of sync because it is not taking the t2.person_id
> >> for some reason.
>
> >> it does this
>
> >> student 1 registers they get t2.person_id=1 - they save data (before
> >> anyone else does) and so student.id is also 1
> >> student 2 registers they get t2.person_id=2 - they don't save data
> >> sudent 3 registers they get t2.person_id=3 - they save data, but the
> >> student.id is set as 2.
>
> >> Shouldn't the default above have prevented this.  It seems the
> >> student.id is just getting set to the next available id when saved.
>
> >> Would it work better to do:
>
> >> db.define_table("student",
> >>       SQLField("id",default=t2.person_id),
>
> >> .....
>
> >> but "id" is already there isn't it?
>
> >> thx,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to