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