i got a ticket:
Traceback (most recent call last):
  File "gluon/restricted.py", line 107, in restricted
  File "/Applications/web2py1.64/web2py.app/Contents/Resources/
applications/2busy/controllers/menu.py", line 103, in <module>
  File "gluon/globals.py", line 100, in <lambda>
  File "/Applications/web2py1.64/web2py.app/Contents/Resources/
applications/2busy/controllers/menu.py", line 74, in projectfile
  File "gluon/tools.py", line 1651, in create
  File "gluon/tools.py", line 1602, in update
  File "gluon/sqlhtml.py", line 501, in __init__
  File "/Applications/web2py1.64/web2py.app/Contents/Resources/
applications/2busy/models/db.py", line 115, in <lambda>
  File "gluon/sql.py", line 1192, in __getitem__
KeyError: 'None'




On 15 Jun., 19:18, mdipierro <mdipie...@cs.depaul.edu> wrote:
> This
>
> db.projectfile.project_id.requires=IS_IN_DB(db,'project.id','%(name)
> s')
>
> in my previous example should do what you ask.
>
> On Jun 15, 11:55 am, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > for perhaps better understanding:
>
> > on the webpage calls projectfile:
>
> > User can chose one of his projects (drop down):   - Project1
> >                                                   - Project2
> >                                                   - Project3
>
> > now he can take some description and upload the file
> > when he click the submit then should the projectid saved
> > in my table projectfile.
>
> > On 15 Jun., 18:12, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > > ähm massimo,
>
> > > how can i do this:
> > > the project_id should change if the youser change the project from the
> > > choose list
> > > here my function:
>
> > > def projectfile():
> > >     db.projectfile.project_id.writable=False
> > >     if auth.is_logged_in():
> > >         form=SQLFORM(db.projectfile,fields=['project_id'
> > >                                         'projectname',
> > >                                         'filename',
> > >                                         'format',
> > >                                         'description',
> > >                                         'datei'])
> > >         if form.accepts(request.vars,session):
> > >             response.flash='Neues File wurde hochgeladen'
> > >         elif len(request.vars):
> > >             response.flash='Fehler beim Hochladen des Files.'
>
> > >         projectfile = db(db.projectfile.userid == auth.user.id).select
> > > (orderby=db.projectfile.cdate)
> > >         return dict(form=form, projectfile=projectfile)
> > >     redirect(URL(r=request,c='default/user',f='login'))
>
> > > thanks
> > > peter
>
> > > On 15 Jun., 17:16, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > > > ok thanks massimo,
>
> > > > i will try it when i come home
>
> > > > peter
>
> > > > On 15 Jun., 15:42, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > I think you need something like this...
>
> > > > > db.define_table('project',SQLField('name'),...other fields...)
> > > > > db.define_table('projectfile',SQLField
> > > > > ('project_id',db.project),....other fields...)
> > > > > db.projectfile.project_id.requires=IS_IN_DB(db,'project.id','%(name)
> > > > > s')
> > > > > db.projectfile.project_id.represent=lambda id: db.project[id].name
>
> > > > > when you create a projectfile use
>
> > > > >    form=crud.create(db.projectfile)
>
> > > > > or
>
> > > > >    db.projectfile.project_id.writable=False
> > > > >    db.projectfile.project_id.default=... the id of the project you are
> > > > > in ...
> > > > >    form=crud.create(db.projectfile)
>
> > > > > and when you delete a project by id:
>
> > > > >     db(db.projectfile.project.id==id).delete() # delete files
> > > > >     db(db.project.id==id).delete() # and delete the project
>
> > > > > Hope this makes sense.
>
> > > > > Massimo
>
> > > > > On Jun 15, 5:24 am, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > > > > > i think i have an idea massimo which can possible solve my problem
> > > > > > but you have to help me.
>
> > > > > > how can i save the project.id in the projectfile table.
>
> > > > > > the user can choose a self created project over a form and i like
> > > > > > to save automaticly the project.id in the table projectfile.
>
> > > > > > how can i do this?
>
> > > > > > peter
>
> > > > > > On 15 Jun., 11:49, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > > > > > > the reference should be the name of the project, projectname
> > > > > > > thanks
> > > > > > > peter
>
> > > > > > > On 15 Jun., 02:40, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > > That is what I thought but I do not see in "projectfile" any 
> > > > > > > > reference
> > > > > > > > field to "project".
>
> > > > > > > > On Jun 14, 4:47 pm, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > > > > > > > > a projectfile should reference a project, but a project can 
> > > > > > > > > have many
> > > > > > > > > projectfiles
>
> > > > > > > > > On 14 Jun., 23:37, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > > > > shouldn't there be a file in projectfile that references a 
> > > > > > > > > > project? Or
> > > > > > > > > > can a projectfile belong to multiple projects?
>
> > > > > > > > > > On Jun 14, 4:13 pm, pk <peter.kirch...@youngdesigners.de> 
> > > > > > > > > > wrote:
>
> > > > > > > > > > > yeah,
> > > > > > > > > > > sorry i think i pressed my self not good enough, when 
> > > > > > > > > > > youser delete a
> > > > > > > > > > > project from the table project
> > > > > > > > > > > then i need a command to delete the accordant file record 
> > > > > > > > > > > from the
> > > > > > > > > > > table file
>
> > > > > > > > > > > thanks
>
> > > > > > > > > > > On 14 Jun., 23:02, mdipierro <mdipie...@cs.depaul.edu> 
> > > > > > > > > > > wrote:
>
> > > > > > > > > > > > this has been default behavior for some time. Have you 
> > > > > > > > > > > > checked it?
> > > > > > > > > > > > Does it not work?
>
> > > > > > > > > > > > Massimo
>
> > > > > > > > > > > > On Jun 14, 11:50 am, pk 
> > > > > > > > > > > > <peter.kirch...@youngdesigners.de> wrote:
>
> > > > > > > > > > > > > Hi together,
>
> > > > > > > > > > > > > i have a question. i have a talbe project and there i 
> > > > > > > > > > > > > can delete
> > > > > > > > > > > > > without any problems.
> > > > > > > > > > > > > i have another table calls projectfile. here is my 
> > > > > > > > > > > > > model:
>
> > > > > > > > > > > > > #########################################################################
> > > > > > > > > > > > > ## Tabelle File
> > > > > > > > > > > > > #########################################################################
> > > > > > > > > > > > > db.define_table('projectfile',
> > > > > > > > > > > > >                 SQLField('userid', 
> > > > > > > > > > > > > default=auth.user.id if auth.user
> > > > > > > > > > > > > else 0, writable=False, readable=False),
> > > > > > > > > > > > >                 SQLField('procreator', 
> > > > > > > > > > > > > default=auth.user.last_name if
> > > > > > > > > > > > > auth.user else 0, writable=False, readable=False),
> > > > > > > > > > > > >                 SQLField('projectname'),
> > > > > > > > > > > > >                 SQLField('filename'),
> > > > > > > > > > > > >                 SQLField('format'),
> > > > > > > > > > > > >                 SQLField('cdate', 'date', 
> > > > > > > > > > > > > default=now),
> > > > > > > > > > > > >                 SQLField('datei','upload'),
> > > > > > > > > > > > >                 SQLField('description','text'))
>
> > > > > > > > > > > > > if auth.is_logged_in():
> > > > > > > > > > > > >     db.projectfile.projectname.requires=IS_IN_DB(db
> > > > > > > > > > > > > (db.project.userid==auth.user.id),'project.pname','%(pname)s')
> > > > > > > > > > > > > db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
> > > > > > > > > > > > > db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
> > > > > > > > > > > > > db.projectfile.filename.requires=[IS_NOT_EMPTY()]
> > > > > > > > > > > > > db.projectfile.format.requires=[IS_NOT_EMPTY()]
> > > > > > > > > > > > > db.projectfile.cdate.requires=[IS_NOT_EMPTY(), 
> > > > > > > > > > > > > IS_DATE()]
> > > > > > > > > > > > > db.projectfile.datei.requires=IS_NOT_EMPTY()
>
> > > > > > > > > > > > > how can i now delete automaticly the file which 
> > > > > > > > > > > > > belong to the project.
>
> > > > > > > > > > > > > here my def:
>
> > > > > > > > > > > > > def deletepro():
> > > > > > > > > > > > >     if auth.is_logged_in():
> > > > > > > > > > > > >         db(db.project.id==request.args[0]).delete()
> > > > > > > > > > > > >         redirect(URL(r=request, f='project'))
> > > > > > > > > > > > >     
> > > > > > > > > > > > > redirect(URL(r=request,c='default/user',f='login'))
>
> > > > > > > > > > > > > thanks for your help
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to