Hello everyone!
---------------------------------------------------------------------------------------------------------------------
This is my model:
db.define_table('autori',
Field('nome_autore', 'string', length=300),
Field('bio', 'text'))
db.define_table('case_discografiche',
Field('nome_casa_discografica', 'string', length=300),
Field('bio_casa_discografica', 'text'))
db.define_table('generi',
Field('genere_musicale','string', length=300))
db.define_table('songs',
Field('titolo', 'string', length=300))
db.define_table('albums',
Field('autore', db.autori),
Field('titolo', 'string', length=600),
Field('genere','string', length=300),
Field('tracklist','text'),
Field('casa_discografica', db.case_discografiche),
Field('copertina', 'upload'))
db.define_table('songs_albums',
Field('song_relation', db.songs),
Field('album_relation', db.albums))
db.autori.nome_autore.requires = IS_NOT_EMPTY(), IS_LOWER(),
IS_NOT_IN_DB(db, 'autori.nome_autore')
db.case_discografiche.nome_casa_discografica.requires = IS_NOT_EMPTY
(), IS_LOWER(), IS_NOT_IN_DB(db,
'case_discografiche.nome_casa_discografica')
db.generi.genere_musicale.requires = IS_NOT_EMPTY(), IS_LOWER(),
IS_NOT_IN_DB(db, 'generi.genere_musicale')
db.albums.autore.requires = IS_IN_DB(db, db.autori.id,'%(nome_autore)
s')
db.albums.titolo.requires = IS_NOT_EMPTY(), IS_LOWER()
db.albums.genere.requires = IS_IN_DB(db,db.generi.id, '%
(genere_musicale)s')
db.albums.casa_discografica.requires = IS_IN_DB
(db,db.case_discografiche.id,'%(nome_casa_discografica)s')
----------------------------------------------------------------------------------------------------------------
A song can be in many albums and an album has many songs so we need a
many to many relationship here. For this reason I've created the table
"songs_albums" where there are relationships between albums and songs.
But I can't figure out how to update this relationship table using
crud! Can you help me please?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" 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
-~----------~----~----~----~------~----~------~--~---