Thanks for the info.
Best Regards
Itamar Cohen
Picatek
Ahornvej 27
DK-7700 Thisted
Denmark
www.picatek.dk
i...@picatek.dk
T: +45 97 91 07 82
M:+45 29 89 07 82
On 22 August 2015 at 20:19, Anthony abasta...@gmail.com wrote:
Yes, I forgot to mention, the dropdowns in the forms are based in the
Thank you Massimo that works perfectly.
Il giorno domenica 23 agosto 2015 02:16:04 UTC+2, Massimo Di Pierro ha
scritto:
Should'd that be
override_code = override[k].ceo_schemes_and_overrides_and_override_codes.
override_code.code1
anyway this should be faster (no nested queries)
Should'd that be
override_code = override[k].ceo_schemes_and_overrides_and_override_codes.
override_code.code1
anyway this should be faster (no nested queries)
override = db((db.ceo_schemes_and_overrides_and_override_codes.ceo_scheme ==
ceo_scheme.id)
Yes, I forgot to mention, the dropdowns in the forms are based in the IS_IN_DB
validator attached to each field. So, you will also have to overwrite the
requires attribute of these two fields with a custom IS_IN_BD validator.
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book
By default, the represent attribute of a reference field is based on the
format attribute of the table it references. So, you have two options --
you could either change the format attributes of the auth_user and
auth_group tables:
db.auth_user._format = '%(first_name)s %(last_name)s' #
Thanks Anthony,
It works (both solutions) in the grid but not in the edit/new forms you get
when clicking on the auth_memebership link in the grid (the id still
appended to the name/role. May be it is OK as you mentioned regarding
uniqueness.
Best Regards
Itamar Cohen
Picatek
Ahornvej 27
DK-7700
Thanks, so the use of field_id is important! I tried your first test which
can be written with the proper field_id *m.id.* This Works:
def test1():
id_company = 1
m, cm = db.meeting, db.co_meet
q = cm.ref_company == id_company
q = q (m.id == cm.ref_meeting)
grid =
Sorry. What I wrote is wrong.
Try this ways:
def test1():
id_company = 1
m, cm = db.meeting, db.co_meet
cm.ref_company.default = id_company
cm.ref_company.readable = cm.ref_company.writable = False
cm.ref_meeting.requires = IS_IN_DB(db, m.id ,'%(title)s')
q =
m, cm = db.meeting, db.co_meet
q = m.id == cm.ref_meeting
q = q (cm.ref_company == 1)
grid = SQLFORM.grid(q, field_id=m.id, fields=[m.id, m.title])
On Sun, May 31, 2015 at 4:48 AM, Ben Lawrence benlawr...@gmail.com wrote:
Both of your answers give a grid of co_meet.
What
Both of your answers give a grid of co_meet.
What would the query be in SQLFORM.grid such that it would be a grid of
db.meeting for one company (not db.co_meet)?
On Thursday, May 7, 2015 at 8:26:47 PM UTC-7, 黄祥 wrote:
had you tried it?
another work around is u can use smartgrid constraints
had you tried it?
another work around is u can use smartgrid constraints
e.g.
def test():
table = db.co_meet
query = db.co_meet.ref_company == 1 # whatever value that refer to
table company
grid = SQLFORM.smartgrid(table, constraints = dict(co_meet=query) )
return locals()
best
Thanks! But wouldn't that just give me a grid of 'co_meet' and not
'meeting'?
On Monday, May 4, 2015 at 9:20:01 AM UTC-7, 黄祥 wrote:
perhaps, you can do
e.g.
def test():
query = db.co_meet.ref_company == 1 # whatever value that refer to
table company
grid=SQLFORM.grid(query)
perhaps, you can do
e.g.
def test():
query = db.co_meet.ref_company == 1 # whatever value that refer to
table company
grid=SQLFORM.grid(query)
return locals()
best regards,
stifan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
-
Thanks a lot Anthony. Now it works.
Il giorno giovedì 31 ottobre 2013 00:12:43 UTC+1, Anthony ha scritto:
{{for company_image in company_images.select():}}
You've already done a select, so don't call .select() again.
{{for company_image in company_images:}}
I'm not sure if I understand you right. What do you mean with category?
Maybe you could try this to get all images with a specific gallery-id:
images = db(db.int_table_galleries_images.gallery.id==1).select()
return dict(images=images)
- Andreas
Am Mittwoch, 30. Oktober 2013 11:51:19 UTC+1
Thanks Andreas.
Sorry I've made a mistake. Now in the company page, I want to show only
images from the 1 gallery.
With images = db(db.int_table_galleries_images.gallery.id==1).select()
I'm still having all images, also from gallery.id==2.
I've also tried with images =
This is discussed here:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Many-to-many
db((db.images.id == db.int_table_galleries_images.image)
(db.galleries.id == db.int_table_galleries_images.gallery)
(db.galleries.id == 1)).select()
Anthony
On Wednesday,
Also, you might consider shortening the name of
db.int_table_galleries_images to just db.galleries_images? You already know
it's a table, so no need for table in the name, and galleries_images
already implies it's a many-to-many intermediate table.
Anthony
On Wednesday, October 30, 2013
Hi Anthony.
This is discussed here:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Many-to-many
I've read it before posting. Result was the same as with the code you've
post:
'Rows' object has no attribute 'select'
Now I've update my db as you've suggest:
{{for company_image in company_images.select():}}
You've already done a select, so don't call .select() again.
{{for company_image in company_images:}}
li{{=A(IMG(_src=URL('download',
args=company_image.image_file_s)), _href=URL('download',
I have a group of employees and a set of skills. One employee can have
many skills and one skill can be had by many employees. What I want to do
is to represent the skills of all employees in one table, where the score
of each employee in each skill is given on a scale from 0 to 5 like:
As Alan says, you don't seem to have a score field. Maybe try this:
db.define_table('online_team',
Field('first_name', notnull=True),
Field('last_name', notnull=True),
Field('email', requires=IS_EMAIL(), notnull=True, unique=True),
Field('initials', notnull=True, unique=True))
...@googlegroups.com javascript:] *On Behalf Of *Massimo Di Pierro
*Sent:* Tuesday, 26 February 2013 4:36 PM
*To:* web...@googlegroups.com javascript:
*Subject:* [web2py] Re: Many to many relationships
we need to che change the book. owner is a keyword in postgresql. When
we wrote the 4th edition
On Monday, February 25, 2013 8:24:48 AM UTC+1, Toby Wilson wrote:
Hi all,
New to web development and web2py. Know a bit of Python.
As a learning experience I’ve written a food tracking program that works
really well in Python and it just runs on my local PC. It just reads and
writes
Toby,
The online Web2py manual explains how to set up many-to-many relationships.
If this is new to you, start reading about one-to-many relationships and
continue from there.
http://web2py.com/books/default/chapter/29/06#One-to-many-relation
On Monday, February 25, 2013 2:24:48 AM UTC-5,
Thanks Cliff and Niphlod... appreciate your assistance.
I'll go through the book a little slower and get clear on this.
In the book it shows an example using the word owner. When I copy and
paste this in, I can't access the database administration option as I get
an internal error with the
we need to che change the book. owner is a keyword in postgresql. When we
wrote the 4th edition of the book, web2py was not checking by default.
recent versions of web2py are checking.
On Monday, 25 February 2013 17:02:09 UTC-6, Toby Wilson wrote:
Thanks Cliff and Niphlod... appreciate your
Thanks Massimo.
Is the second point regarding the shell I raise a known issue as well?
From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of
Massimo Di Pierro
Sent: Tuesday, 26 February 2013 4:36 PM
To: web2py@googlegroups.com
Subject: [web2py] Re: Many
I think your idea will work, that sounds the best.
On Friday, March 9, 2012 5:21:33 AM UTC-7, Wikus van de Merwe wrote:
What pbreit suggested assumes that all the company servers are at the same
location as the company, which I guess is not what you wanted.
It think it should rather be:
What pbreit suggested assumes that all the company servers are at the same
location as the company, which I guess is not what you wanted.
It think it should rather be:
db.define_table('company',
Field('name'),
Field('location', db.location))
db.define_table('server',
Field('name'),
I don't really understand the question but I would think something like
this:
db.define_table('company',
Field('name'))
db.define_table('server',
Field('name'),
Field('company', db.company),
Field('location', db.location))
db.define_table('location',
Field('name'))
Or
Nope, your way is the better way :)
On Friday, March 9, 2012 8:14:57 AM UTC+8, Derek wrote:
Let's say I am designing a database.
It has these elements:
Companies, Locations, Servers
Each company has one location, and one or more servers.
Each server has one and only one location.
So,
This might give you some
ideas:
http://web2py.com/books/default/chapter/29/7#One-form-for-multiple-tables.
I suppose you would have to loop through the list of submitted authors to
insert multiple records into the verb table.
Anthony
On Monday, January 16, 2012 3:35:16 PM UTC-5, Christian
Antony, thank you, i tried exactly this some weeks ago and it did not
work. Since now... may be, that i worked not enough. I will try more and we
will see.
Anthony, the basic recommendation was to use SQLFORM.factory, and that was
a good idea. I tried it again and i had now more success than some weeks
before. So now i can insert rows in the table book and the table verb
in one FORM and with only one submit-button. The FORM looks like this:
OK,
Here are some resources you will want to check out if you have not found
them on your own already.
# Web2py Plugins
## http://web2py.com/plugins/default
### looks good
http://web2py.com/plugins/default/tagging
### interesting
http://web2py.com/plugins/default/multiselect
OK thanks, I will take a look through the resources you have provided.
--
Regards,
Bruce
On Wed, Dec 28, 2011 at 12:35 PM, Christopher Steel
chris.st...@gmail.comwrote:
OK,
Here are some resources you will want to check out if you have not found
them on your own already.
# Web2py Plugins
OK, If your database table is setup correctly then in the database examples
section you should be able to create a form similar to the one in example
33 for a many to many relationship.
http://web2py.com/examples/database_examples/buy
(
That example doesn't look like a true many-to-many it looks like a
one-to-many. Because in the example it searches for both id's already being
in the many-to-many table and if they are it only updates. Where as a true
many to many you would have multiple entries IE: (1, 1, 20), (1, 1, 40),
I think what you mean to say is that you are are looking for the ability to
make multiple selections in one or more tables using a single form that
allows you create a user record.
So for example a table of users, a table of email address types and a table
of email addresses but the user on
Hi Christopher,
*
*
*That is pretty much what I am after.*
*
*
*table = keywords values ('Art', 'Games', 'Money') # Used to find all ads
related based on keywords they select*
*table = ad (*
* url,*
* created_by*
* keywords - can have 0 or more keywords, keywords can belong to 0 or more
ad's*
For an example of a Web2py database with a many to many relationship you
can see example number 29 under the database examples section:
http://web2py.com/examples/default/examples
Go to the section called Database Examples
See the first example
I looked at the examples they seem to just show how to link at the database
level. From my example code I already have that part working. It is at the
form/view level I am looking at adding functionality.
On Sat, Dec 24, 2011 at 9:41 AM, Christopher Steel chris.st...@gmail.comwrote:
For an
I am guessing from the lack of responses this is not possible with Web2py's
current admin?
On Wed, Dec 21, 2011 at 4:49 PM, Bruce Wade bruce.w...@gmail.com wrote:
Hello, I know django has this ability so I am assuming web2py also does.
(Here is to hoping :D)
First the models:
The web2py admin works diferently to the django admin.
The web2py admin is for install apps and manage instances.
2011/12/23 Bruce Wade bruce.w...@gmail.com
I am guessing from the lack of responses this is not possible with
Web2py's current admin?
On Wed, Dec 21, 2011 at 4:49 PM, Bruce
I understand that, but you can also use the database portion to create new
data. That is mainly the part I am talking about.
When clicking database then insert in a table, it would be nice if the
relationships could be linked on that insert. This would make performing
inserts more efficiently.
On Dec 23, 10:11 am, Bruce Wade bruce.w...@gmail.com wrote:
Anyway which files should I start looking at to see how I can implement
this functionality for myself and anyone else who wants it?
Look for controller appadmin under your or any other app folder.
I have solved these kinds of concerns with pyramid based applications using
sqlalchemy. However I need to look into the core of how Web2py handles
things to figure out the best way.
Sqlachemy allows you to put everything in:
1) Transactions
2) Sessions
So on submit you first create the parent
web2py wraps each request in a single transaction by default, so if you
make multiple inserts during a request and the request ultimately fails due
to an error, the inserts should be rolled back automatically.
See http://web2py.com/books/default/chapter/29/4#Workflow
and
This something I would definitely be interested in seeing, as well as
input forms for many-to-many in general (not just admin).
Thanks
Vincent
On Dec 23, 12:50 pm, Anthony abasta...@gmail.com wrote:
web2py wraps each request in a single transaction by default, so if you
make multiple inserts
Grazie.
This unlocks a door. I thought I had to repeat the call to left()
same as the SQL.
On Oct 6, 5:13 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
Here is your SQL:
SELECT purchase_orders.issue_date, purchase_orders.number,
products.name
FROM purchase_orders LEFT JOIN
Why do you left join products if you do not select anything from it?
On Oct 6, 7:40 am, Cliff cjk...@gmail.com wrote:
Here is the model, simplified:
db.define_table('purchase_orders',
Field('issue_date', 'date',
comment = SPAN(a_comment, _style='color:orange;')),
Actually 'name' comes from products.
Maybe it would be clearer this way:
SELECT purchase_orders.issue_date,
purchase_orders.number,
products.name
FROM purchase_orders LEFT JOIN
purchase_order_products ON purchase_order_products.purchase_order_id
=
purchase_orders.id LEFT JOIN products ON
Here is your SQL:
SELECT purchase_orders.issue_date, purchase_orders.number,
products.name
FROM purchase_orders LEFT JOIN purchase_order_products ON
purchase_order_products.purchase_order_id = purchase_orders.id LEFT
JOIN products ON purchase_order_products.product_id = products.id
where and how are the pictures stores? will you be adding them to the
blobstore or references pictures elsewhere?
Thank you for reply.
My problem is,
I have problem in choosing one approach over other.
1) Use a mapping table
2) Or use list reference.
My tables are something like this:
Table :Picture Word
Word: Coffee: Picture: Both the picture below represent word coffee.
(ie., for one word many pictures)
Arun,
this line:
persons_and_dogs = db((db.person.id==db.ownership.person)
(db.dog.id==db.ownership.dog))
won't run on GAE because of the joins. You can choose to keep the data
structure as you have it and run 2 queries and mesh the results. before
the advent of list properties i was doing
I'm still learning widget stuff, and while I can design a many-to-many
widget, I am having trouble visualizing how to produce one with extra
fields and buttons for adding/removing. I might strike an epiphany,
but I'll likely just wait for you to make something available.
On Nov 12, 11:27 am,
We do not have a widget for that but it is time to make one. It is not
difficult.
If I have time I will do this over the week-end. Other users may have
already something working.
On Nov 12, 10:17 am, Joe Wakefield coffeeburr...@gmail.com wrote:
So I'm trying to migrate an old rails app that
Speedwise, you should use many2many if you plan to search the referee
by the refereed. If you only need the refereed after you already have
the referee you can use list:reference. If you are on GAE
list:reference is better because native and GAe has no joins.
On Nov 9, 2:43 pm, Carlos
Thank you for the suggestions, Massimo.
I've tried to update the model here:
http://code.google.com/p/publicradioroadtrip/source/browse/models/db_custom.py
based on your suggestions, and the example app here:
http://www.web2py.com/book/default/chapter/03#A-Wiki
However, if I use the line:
Models are executed alphabetically. Make sure that
auth=Auth(...)
auth.define_tables()
are executed before your table definition.
On Sep 29, 1:13 am, johntynan jgty...@gmail.com wrote:
Thank you for the suggestions, Massimo.
I've tried to update the model here:
what is me? Do you use auth? why the type of created_by is a string?
On Sep 28, 10:01 pm, johntynan jgty...@gmail.com wrote:
I would like to create a many-to-many relationship in the following
model, where many stories can appear in many different
roadtrips (think songs to mixtapes).
if auth.is_logged_in():
me=auth.user.id
else:
me=None
On Sep 29, 5:19 am, mdipierro mdipie...@cs.depaul.edu wrote:
what is me? Do you use auth? why the type of created_by is a string?
On Sep 28, 10:01 pm, johntynan jgty...@gmail.com wrote:
I would like to create a many-to-many
just use
auth.user_id
is the same
created_by should be type=db.auth_user
On Sep 28, 10:31 pm, johntynan jgty...@gmail.com wrote:
if auth.is_logged_in():
me=auth.user.id
else:
me=None
On Sep 29, 5:19 am, mdipierro mdipie...@cs.depaul.edu wrote:
what is me? Do you use auth? why
If I understand:
for row in db(db.link_table.table1==r.id)
(db.table2.id==db.linked_table.table2).select(db.table2.id,db.table2.other):
print row.id, row.other
if no double links else
sub=db(db.link_table.table1==r.id)._select(db.linked_table.table2)
for row in
Ah, belongs() + a clever select SQL.
Thanks.
Al
On Jun 29, 7:04 pm, mdipierro mdipie...@cs.depaul.edu wrote:
If I understand:
for row in db(db.link_table.table1==r.id)
(db.table2.id==db.linked_table.table2).select(db.table2.id,db.table2.other):
print row.id, row.other
if no double
67 matches
Mail list logo