Hi John,
One step at a time, looking at your database model, how does 'copies'
relate to a book ? You are missing a foreign key reference. Are there
any other attributes that a copy may have ?
On Saturday, May 24, 2014 7:30:35 AM UTC+10, john smith wrote:
>
> I'm trying to create library system and have a little problem. Here's my
> current model:
> db.define_table('tags',
> Field('name'),format='%(name)s')
> db.define_table('copies',
> Field('is_active','boolean',default=True))
>
> db.define_table('book',
> Field('title',requires=IS_NOT_EMPTY(), label='Tytuł'),
> Field('author', requires=IS_NOT_EMPTY(), label='Autor'),
> Field('isbn', 'integer', requires=IS_LENGTH(13), label='ISBN'),
> Field('release_year', 'integer', requires=IS_INT_IN_RANGE(-3000,
> request.utcnow.year+1), label='Rok wydania'),
> Field('format', label='Format'),
> Field('cover', 'upload', requires = IS_EMPTY_OR(IS_IMAGE()),
> label='Okładka'),
> Field('publisher', label='Wydawca'),
> Field('tags', 'list:reference tags', label='Tagi'),
> Field('copies', db.copies),
> auth.signature)
>
> db.book.tags.widget = SQLFORM.widgets.checkboxes.widget
>
> Here is what I want to achieve: when a user adds new 'book' table record,
> he types number of copies of that book and that amount of records is
> automatically created in 'copies' table. Then a user will be able to loan a
> specific copy of a book (i will probably be able to figure this part out
> thanks to library example) but only for specific period. If you have other
> ideas on how to solve my problem, please share.
> Also less important but i would like to change the style of my tags
> widget, so it would display either set number of tags per row or just
> display maximum number that will fit in screen.
> Thanks in advance for all replies.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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/d/optout.