Re: [web2py] Re: Delete a row from one table when two tables are joined

2017-02-23 Thread Mat Miles
Actually that solution was not quite correct. The one below is.

if form.process(formname='form').accepted:
rows = db(db.auth_user.location_id ==
auth.user.location_id).select(db.auth_user.id)

db(db.shift_availability.created_by.belongs(rows)).delete()


On Thu, Feb 23, 2017 at 12:57 PM, Mat Miles <matjmi...@gmail.com> wrote:

> Thanks that worked. I have a shift_availability table and the auth_user
> table. The auth_user table contains a location. I want to clear all the
> rows in the shift_availability table but by location. Below is the solution:
>
> if form.process(formname='form').accepted:
> rows = db((db.shift_availability.created_by == db.auth_user.id)
>   & (db.auth_user.location_id == 
> auth.user.location_id)).select(db.shift_availability.id)
>
> db(db.shift_availability.id.belongs(rows)).delete()
>
>
> On Wed, Feb 22, 2017 at 5:14 PM, Dave S <snidely@gmail.com> wrote:
>
>> On Wednesday, February 22, 2017 at 4:03:00 PM UTC-8, Mat Miles wrote:
>>>
>>> I need to create a join to limit the rows to be deleted. Is it possible
>>> to delete a row from one table when a query joins two tables?
>>>
>>
>> Not sure about the full answer, but a partial answer would be to use the
>> join in a SELECT ( db(...).select(), frex) and obtain the row ids, then do
>> a seperate DELETE using those row ids.
>>
>> /dps
>>
>>
>> --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/web2py/6V2skxjxNG0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Delete a row from one table when two tables are joined

2017-02-23 Thread Mat Miles
Thanks that worked. I have a shift_availability table and the auth_user
table. The auth_user table contains a location. I want to clear all the
rows in the shift_availability table but by location. Below is the solution:

if form.process(formname='form').accepted:
rows = db((db.shift_availability.created_by == db.auth_user.id)
  & (db.auth_user.location_id ==
auth.user.location_id)).select(db.shift_availability.id)

db(db.shift_availability.id.belongs(rows)).delete()


On Wed, Feb 22, 2017 at 5:14 PM, Dave S <snidely@gmail.com> wrote:

> On Wednesday, February 22, 2017 at 4:03:00 PM UTC-8, Mat Miles wrote:
>>
>> I need to create a join to limit the rows to be deleted. Is it possible
>> to delete a row from one table when a query joins two tables?
>>
>
> Not sure about the full answer, but a partial answer would be to use the
> join in a SELECT ( db(...).select(), frex) and obtain the row ids, then do
> a seperate DELETE using those row ids.
>
> /dps
>
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/6V2skxjxNG0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Delete a row from one table when two tables are joined

2017-02-22 Thread Mat Miles
I need to create a join to limit the rows to be deleted. Is it possible to 
delete a row from one table when a query joins two tables?

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: smtp mail in web2py 2.14.6-stable+timestamp.2016.05.10.00.21.47

2017-02-21 Thread Mat Miles
Thanks, that worked. Ymail works on pythonanywhere in my old web2py
environment but not in the new. The gmail smtp works in the latest version
of web2py.

On Tue, Feb 21, 2017 at 9:32 AM, Leonel Câmara 
wrote:

> https://help.pythonanywhere.com/pages/SMTPForFreeUsers
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/nblqUmE5p78/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] smtp mail in web2py 2.14.6-stable+timestamp.2016.05.10.00.21.47

2017-02-21 Thread Mat Miles
I created a new environment on Pythonanywhere. I have used smtp mail in 
older versions of web2py and it works just fine. However, in this new 
environment I get an error that the mail cannot be sent. Has anyone else 
experienced this?

Thanks in advance. 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: why you should upgrade to web2py 2.13.4

2016-12-28 Thread Mat Miles
Waiting for Pythonanywhere to add this to their upgrade option.

On Saturday, December 26, 2015 at 1:22:27 AM UTC-7, Massimo Di Pierro wrote:
>
> There are many reasons you should upgrade, depending on which version you 
> are using now:
>
> - to help us make sure we did not break backward compatibility. If your 
> existing app does not work with 2.13.4 (and it should) you give us a chance 
> to fix the problem. If no, any potential incompatibility will propagate 
> forward making it more difficult for us to fix it later, and more difficult 
> for you to upgrade.
>
> - to take advantage of new features. For example the awesome JWT feature 
> that allows to create API tokens and use them for authentication without 
> hitting the database.
>
> - there is also an important security bug fix in 2.13.4 related to 
> auth.settings.registration_requires_approval=True. The bug allows a newly 
> registered user to bypass the approval process and approve himself/herself. 
> Under come conditions. This is now fixed.
>
> Massimo
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] "Uploading and install packed application" works, but running database administration fails

2015-12-16 Thread Mat Miles
1.  In the Web2py administrative interface I select "pack all" to output an 
application I have created. 
2.  I then select "Upload and install packed application" to a new project 
with the name of dev and upload the application I just packed.
3.  I then edit db.py to change the db = DAL to a different database
4. When I click on database administration it fails with the error below.

 (1452, 'Cannot add or update a 
child row: a foreign key constraint fails 
(`milesm$scheduler_dev`.`auth_permission`, CONSTRAINT 
`auth_permission_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `auth_group` 
(`id`) ON DELETE CASCADE)')

This is on pythonanywhere using mysql.

Any help wold be greatly appreciated.


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Changing order of auth_user fields

2015-07-15 Thread Mat Miles
Has this functionality been added?

On Wednesday, October 22, 2014 at 8:24:05 PM UTC-6, Massimo Di Pierro wrote:

 Please open a ticket about this. There is not a way but there should be.

 On Friday, 17 October 2014 16:50:37 UTC-5, Spokes wrote:

 I've added a middle name field to *auth_user* by doing the following:

 auth.settings.extra_fields['auth_user']= [
  Field('middle_name', type = string, length = 16, label = current.T
 ('Middle Name'))]

 This means that when a form is automatically generated from *auth_user, *the 
 order of the fields will be awkward. For example, the auth.register() 
 function produces input fields in the following order: first name, last 
 name, ... , password, middle name, confirm password.

 Is there a way to change the default order of the fields? Thanks.



-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Upgrade to Web2py 2.10.4 breaks date field search in sqlform.grid

2015-06-05 Thread Mat Miles
That seems to have fixed the date issue but I have another field that it
did not fix. This field is populate not from a database but from a SET.
When you try to filter on the values from the SET, instead of getting a
drop down, you only get an empty text box. This also worked fine before the
upgrade.

On Fri, Jun 5, 2015 at 2:11 PM, Niphlod niph...@gmail.com wrote:

 once again surrounded by a brilliant white light of not supporting
 different sets of specific css-widgets...

 issue https://github.com/web2py/web2py/issues/994
 PR that fixes https://github.com/web2py/web2py/pull/995

 On Friday, June 5, 2015 at 2:52:18 PM UTC+2, Massimo Di Pierro wrote:

 Please open a ticket about this.



-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Upgrade to Web2py 2.10.4 breaks date field search in sqlform.grid

2015-06-04 Thread Mat Miles
I upgraded Web2py to version 2.10.4 on Pythonanywhere which has created a 
problem with SQLFORM.grid. I have a table that has a date field. When you 
attempt to search by this date field in a SQLFORM.grid, the date picker no 
longer appears, just a test box. Date fields are still working fine when 
using SQLFORM.factory. The proper date picker still displays. Has anyone 
else seen this problem? If so, do you know how to resolve it?

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] DAL for Insert Into with Select

2015-02-26 Thread Mat Miles
Is it possible to use the DAL to run an INSERT INTO with a select list? I 
haven't figured out a way to make this work using db.executesql() because I 
need to pass a date to the query. I don't see a way to pass a variable into 
db.executesql().

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: First post: Is this a bug?

2015-02-25 Thread Mat Miles
I found that the problem was that my tables had become corrupted by making
too many changes at once. When I removed the tables, ran database admin,
then re-added the tables it worked. It was not related to the different db
types.
On Feb 24, 2015 1:45 PM, Niphlod niph...@gmail.com wrote:

 the first thing to be noted is that you'd need to define the referencED
 table before the referencING one. not strictly needed always but a good
 place to start.

 On Monday, February 23, 2015 at 11:44:43 PM UTC+1, Mat Miles wrote:

 db.define_table('daily_schedule',
 Field('the_day', type='date', label='Schedule Day',
 requires=IS_NOT_EMPTY()),
 Field('assignment_type_id', type='reference
 assignment_type', label='Assignment', requires=IS_NOT_EMPTY()),
 format = '%(the_day)s')

 db.define_table('assignment_type',
 Field('name', type='string', label='Assignment Type'),
 format = '%(name)s')

 On Sunday, February 22, 2015 at 8:37:31 PM UTC-7, Mat Miles wrote:

 I had a project that a number of tables that reference other tables
 using MySQL as the DB. I started another project using SQlite and the
 reference tables did not work. I went over and over the project to see if I
 had a typo somewhere and could not find one. Finally I converted the table
 to MSSQL and the references began working. Is this a bug, or is there some
 configuration option that I am missing when using SQlite?

 What I mean by the reference tables not working is that when you go to
 create a new record where one of the fields is referencing values in
 another table, the box would show for the field, but it would display as a
 text field with no values and not a dropdown list.

 -mat


  --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/uiFt4csLo-k/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: First post: Is this a bug?

2015-02-24 Thread Mat Miles
db.define_table('daily_schedule',
Field('the_day', type='date', label='Schedule Day', 
requires=IS_NOT_EMPTY()),
Field('assignment_type_id', type='reference 
assignment_type', label='Assignment', requires=IS_NOT_EMPTY()),
format = '%(the_day)s')

db.define_table('assignment_type',
Field('name', type='string', label='Assignment Type'),
format = '%(name)s')

On Sunday, February 22, 2015 at 8:37:31 PM UTC-7, Mat Miles wrote:

 I had a project that a number of tables that reference other tables using 
 MySQL as the DB. I started another project using SQlite and the reference 
 tables did not work. I went over and over the project to see if I had a 
 typo somewhere and could not find one. Finally I converted the table to 
 MSSQL and the references began working. Is this a bug, or is there some 
 configuration option that I am missing when using SQlite?

 What I mean by the reference tables not working is that when you go to 
 create a new record where one of the fields is referencing values in 
 another table, the box would show for the field, but it would display as a 
 text field with no values and not a dropdown list.

 -mat




-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] First post: Is this a bug?

2015-02-22 Thread Mat Miles
I had a project that a number of tables that reference other tables using 
MySQL as the DB. I started another project using SQlite and the reference 
tables did not work. I went over and over the project to see if I had a 
typo somewhere and could not find one. Finally I converted the table to 
MSSQL and the references began working. Is this a bug, or is there some 
configuration option that I am missing when using SQlite?

What I mean by the reference tables not working is that when you go to 
create a new record where one of the fields is referencing values in 
another table, the box would show for the field, but it would display as a 
text field with no values and not a dropdown list.

-mat


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.