Re: [web2py] How to filter a referenced field in a for
Sorry for my late reply That is what i was looking for... thanks Op woensdag 6 november 2019 21:45:29 UTC+1 schreef Massimiliano: > > Try with: > > Is_empty_or(is_in_db(...)) > > Il giorno mer 6 nov 2019 alle 15:34 Steve > > ha scritto: > >> Hi, >> >> I have a SQLFORM which has 2 fields referenced all to another Product >> table. >> In this form you can select 1 or more products but only first is >> mandatory, the other one is optional. >> >> The problem i have is that i don't want all the products in the dropdown >> list but only the products which are for example are in stock, the others i >> don't want in the list. >> For the mandatoy field , i don't have an issue because i use >> "requires=IS_IN_DB(..." >> >> But for the other fields, which are not mandatory, i am not able to >> filter the dropdown list, if i use IS_IN_DB that yoou have to fill in the >> form field , but as said i would like to leave second product selection >> optional >> >> Can anyone help me on my way. >> >> db.define_table('werkgroep', >> Field('omschrijving', requires=IS_NOT_EMPTY()), >> Field('product1',requires = IS_IN_DB(db(db.product.stock >> <> 1), db.product, '%(first_name)s %(last_name)s'), label=T('Product 1')), >> Field('product2',db.product, label=T('Practitioner 2')) >> ) >> >> db.define_table('product', >> Field('name',requires=IS_NOT_EMPTY()), >> Field('stock', 'integer', requires=IS_NOT_EMPTY() >> ) >> >> Hope you can help me, >> >> Steve >> >> -- >> 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 web...@googlegroups.com . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/d4de53e3-5dd2-448a-8e70-0f7e94edfd46%40googlegroups.com >> >> <https://groups.google.com/d/msgid/web2py/d4de53e3-5dd2-448a-8e70-0f7e94edfd46%40googlegroups.com?utm_medium=email_source=footer> >> . >> > -- > Massimiliano > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/98cb4918-1d29-4eea-aff5-18a378bf5bf5%40googlegroups.com.
[web2py] How to filter a referenced field in a for
Hi, I have a SQLFORM which has 2 fields referenced all to another Product table. In this form you can select 1 or more products but only first is mandatory, the other one is optional. The problem i have is that i don't want all the products in the dropdown list but only the products which are for example are in stock, the others i don't want in the list. For the mandatoy field , i don't have an issue because i use "requires=IS_IN_DB(..." But for the other fields, which are not mandatory, i am not able to filter the dropdown list, if i use IS_IN_DB that yoou have to fill in the form field , but as said i would like to leave second product selection optional Can anyone help me on my way. db.define_table('werkgroep', Field('omschrijving', requires=IS_NOT_EMPTY()), Field('product1',requires = IS_IN_DB(db(db.product.stock <> 1), db.product, '%(first_name)s %(last_name)s'), label=T('Product 1')), Field('product2',db.product, label=T('Practitioner 2')) ) db.define_table('product', Field('name',requires=IS_NOT_EMPTY()), Field('stock', 'integer', requires=IS_NOT_EMPTY() ) Hope you can help me, Steve -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/d4de53e3-5dd2-448a-8e70-0f7e94edfd46%40googlegroups.com.
[web2py] Re: 1215 Cannot add foreign key constraint
Hi Dave, Finally i got to the root of the problem :-) Turns out to be a builders error ... yes, my own error. In the very first table there is a reference to a logged in user which does not exist when trying to create the tables ( same for loading the data). Quick work around is swapping two tables and after that prefill the first table with a couple of records. After that i could upload my backup data withoout a problem. Thanks for the help. Rgards, Steve Op donderdag 12 september 2019 10:49:15 UTC+2 schreef Dave S: > > > > On Wednesday, September 11, 2019 at 1:55:04 PM UTC-7, Steve wrote: >> >> Hi Dave, >> >> After performing a Fake_migration_all=True the Db files where created in >> de app/databases folder. >> So, in de admin i can see all of the tables. >> >> But, unfortunatly the tables where NOT created in the MySQL database. >> I can't find ou why not or how to fix this. >> >> > fake_migration ONLY creates *.table files, and is primarily for already > existing tables (e.g., legacy) DBs. To create an actual DB table requires > migration rather than fake_migration. And as Niphlod has often pointed > out, migrate=True only needs to be set for one access, and then you turn it > back off. > > /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 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/da151e9d-573d-4274-a07b-b1341b9d8ead%40googlegroups.com.
[web2py] Re: 1215 Cannot add foreign key constraint
Hi Dave, Ok, that fake_migration only creates *.tables file i did not know Migrate True only one time .. that i knew but for some reason only 1 table is created from the 25+ so something is wrong. Don't know what yet Op donderdag 12 september 2019 10:49:15 UTC+2 schreef Dave S: > > > > On Wednesday, September 11, 2019 at 1:55:04 PM UTC-7, Steve wrote: >> >> Hi Dave, >> >> After performing a Fake_migration_all=True the Db files where created in >> de app/databases folder. >> So, in de admin i can see all of the tables. >> >> But, unfortunatly the tables where NOT created in the MySQL database. >> I can't find ou why not or how to fix this. >> >> > fake_migration ONLY creates *.table files, and is primarily for already > existing tables (e.g., legacy) DBs. To create an actual DB table requires > migration rather than fake_migration. And as Niphlod has often pointed > out, migrate=True only needs to be set for one access, and then you turn it > back off. > > /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 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/d70f19b2-1f97-49ca-9c8b-5b1da7b02db8%40googlegroups.com.
[web2py] Re: 1215 Cannot add foreign key constraint
Hi Dave, After performing a Fake_migration_all=True the Db files where created in de app/databases folder. So, in de admin i can see all of the tables. But, unfortunatly the tables where NOT created in the MySQL database. I can't find ou why not or how to fix this. Already went to the document about broken migrations but no luck yet. The exact error: ProgrammingError: (1146, u"Table 'abc' doesn't exist") Any idea's how to fix this regards, Steve Op woensdag 11 september 2019 10:35:22 UTC+2 schreef Dave S: > > > > On Tuesday, September 10, 2019 at 2:58:06 PM UTC-7, Steve wrote: >> >> Goodevening, >> >> I am trying to migrate from Sqite to MySQL. >> Unfortunatly when restoring the field in the DB tables i get the >> following error: >> (1215, u'Cannot add >> foreign key constraint') >> location of issue: Field('Insurance',db.insurance,label=T('Insurance')), >> >> When i look this up in google this could be caused by a Field which >> has the reuirement= Not NULL but has no Default value set. >> I tested this but not able to get passed the error. >> >> *first table with field in db1.py* >> >> db.define_table('insurance', >> >> Field('Company',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), >> label=T('Company')), >> Field('Insurance_number','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), >> label=T('Insurance Number')), >> Field('Street_name', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Street >> Name')), >> Field('House_number','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('House >> Number')), >> Field('Postal_code','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'),label=T('Postal >> Code')), >> Field('City','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('City')), >> Field('Region','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Region')), >> Field('Country','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), >> label=T('Country')), >> Field('Telephone_number','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Telephone >> Number')), >> Field('Mobile','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Mobile')), >> Field('Email','string', >> requires=IS_EMAIL(error_message='invalid email! Please fill in a correct >> e-mail address.'), label=T('Email')), >> auth.signature, format='%(Company)s',fake_migrate=True) >> >> *Second table which in a db2.py:* >> >> db.define_table('client', >> >> Field('Debtor_nr',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), >> label=T('Debtor number')), >> Field('Insurance',db.insurance,label=T('Insurance')), --> >> this >> is where the first issue takes place >> >> Where should i add a default value ? to et this issue fixed >> >> Hope you can help me with this >> >> Steve >> > > This page has different diagnoses than you mention: > https://www.rathishkumar.in/2016/01/solved-how-to-solve-mysql-error-code.html > > > > There, the issue with NULL is that the foreign key can't be NULL if it is > part of the child table's primary key. > > Another way to get the error is to use a different mysql storage engine > than innodb. > > Yet another way is to not have a unique key in the table, but since you're > using a model file to describe the parent table, the DAL should have > handled that, and also made sure that the parent and child agree on what > the key is. > > As a first step, use your mysql console or dbclient to display the schema > used for the insurance table. (I can't tell you how to do that, because > I use sqlite and postgres, not mysql, so I know two incantations but they > probably don't match what you need). > > Good luck! > > /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 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/3a3f9919-0ced-491f-9a89-6e5db99059da%40googlegroups.com.
[web2py] Re: 1215 Cannot add foreign key constraint
Hi Dave, Thanks for your reply. When starting web2py again the DAL tries to create the tables but none of the tables are being created due to this error. Using a clean new version of a web2py app the tables are created and are of type innodb storage engine( as mentioned in the page you sent). I am still no step further with solving this issue. Steve Op woensdag 11 september 2019 10:35:22 UTC+2 schreef Dave S: > > > > On Tuesday, September 10, 2019 at 2:58:06 PM UTC-7, Steve wrote: >> >> Goodevening, >> >> I am trying to migrate from Sqite to MySQL. >> Unfortunatly when restoring the field in the DB tables i get the >> following error: >> (1215, u'Cannot add >> foreign key constraint') >> location of issue: Field('Insurance',db.insurance,label=T('Insurance')), >> >> When i look this up in google this could be caused by a Field which >> has the reuirement= Not NULL but has no Default value set. >> I tested this but not able to get passed the error. >> >> *first table with field in db1.py* >> >> db.define_table('insurance', >> >> Field('Company',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), >> label=T('Company')), >> Field('Insurance_number','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), >> label=T('Insurance Number')), >> Field('Street_name', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Street >> Name')), >> Field('House_number','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('House >> Number')), >> Field('Postal_code','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'),label=T('Postal >> Code')), >> Field('City','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('City')), >> Field('Region','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Region')), >> Field('Country','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), >> label=T('Country')), >> Field('Telephone_number','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Telephone >> Number')), >> Field('Mobile','string', >> requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Mobile')), >> Field('Email','string', >> requires=IS_EMAIL(error_message='invalid email! Please fill in a correct >> e-mail address.'), label=T('Email')), >> auth.signature, format='%(Company)s',fake_migrate=True) >> >> *Second table which in a db2.py:* >> >> db.define_table('client', >> >> Field('Debtor_nr',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), >> label=T('Debtor number')), >> Field('Insurance',db.insurance,label=T('Insurance')), --> >> this >> is where the first issue takes place >> >> Where should i add a default value ? to et this issue fixed >> >> Hope you can help me with this >> >> Steve >> > > This page has different diagnoses than you mention: > https://www.rathishkumar.in/2016/01/solved-how-to-solve-mysql-error-code.html > > > > There, the issue with NULL is that the foreign key can't be NULL if it is > part of the child table's primary key. > > Another way to get the error is to use a different mysql storage engine > than innodb. > > Yet another way is to not have a unique key in the table, but since you're > using a model file to describe the parent table, the DAL should have > handled that, and also made sure that the parent and child agree on what > the key is. > > As a first step, use your mysql console or dbclient to display the schema > used for the insurance table. (I can't tell you how to do that, because > I use sqlite and postgres, not mysql, so I know two incantations but they > probably don't match what you need). > > Good luck! > > /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 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/2e2fc51b-5120-47e6-99a8-dd0fbca276a4%40googlegroups.com.
[web2py] 1215 Cannot add foreign key constraint
Goodevening, I am trying to migrate from Sqite to MySQL. Unfortunatly when restoring the field in the DB tables i get the following error: (1215, u'Cannot add foreign key constraint') location of issue: Field('Insurance',db.insurance,label=T('Insurance')), When i look this up in google this could be caused by a Field which has the reuirement= Not NULL but has no Default value set. I tested this but not able to get passed the error. *first table with field in db1.py* db.define_table('insurance', Field('Company',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Company')), Field('Insurance_number','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Insurance Number')), Field('Street_name', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Street Name')), Field('House_number','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('House Number')), Field('Postal_code','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'),label=T('Postal Code')), Field('City','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('City')), Field('Region','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Region')), Field('Country','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Country')), Field('Telephone_number','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Telephone Number')), Field('Mobile','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Mobile')), Field('Email','string', requires=IS_EMAIL(error_message='invalid email! Please fill in a correct e-mail address.'), label=T('Email')), auth.signature, format='%(Company)s',fake_migrate=True) *Second table which in a db2.py:* db.define_table('client', Field('Debtor_nr',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Debtor number')), Field('Insurance',db.insurance,label=T('Insurance')), --> this is where the first issue takes place Where should i add a default value ? to et this issue fixed Hope you can help me with this Steve -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/8e093bfc-0af8-42de-a260-09447281b183%40googlegroups.com.
[web2py] How to use cache
Goodmorning, I have created an app, where i would like to use caching but i get stuck on the documentation how to us @cache.action. The website i have is only for registered users, who will land on their own pages, with their own info. Can i use @cache.action to speed things up and how do i implement this ? ( i have added the @cache.action to the index controller, which speeds up the page a lot but when you try to log out, it stays on the page and i get weird behaviour) So apperently i am doing things wrong. Anyone a suggestion regards, Steve -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/e878cd61-78e4-4f3a-8922-a06a13d86461%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Files in Static folder not showing in admin interface
Hi All, Something weird has happend. After installing plugin, all the files ( except 1) in the static folder are not showing in the admin interface. When i check those files they are present in the static folder and the website can find and use those files. Anyone any idea why this happens ? See added screenshots Thanks, Steve -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/cd6752c3-81a0-4a02-9c6c-37b3363f98a7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Foreign key error after adding new table instance
OK, After searching the sqlite db and the views problem solved. DB inegrity was ok ... the view was wrong Op zondag 16 juni 2019 17:53:33 UTC+2 schreef Steve: > > Hi All, > > Busy with my platform, just added some tables. > I have defined extra fields for the Auth table. > > In 1 of the aded fields i use a different table to get some info. > 2 days ago i added 3 row's which are available for me to select. When i > add a new user i am able te select one of those rows and add the user ...NO > PROBLEM > > Today i added 1 extre row to the referenced field, and suddenly i get an > FOREIGN KEY error, and only when i select the newly added row. If i select > one of the other rows ... NO PROBLEM > > Anyone any idea why this can happen . > > > > db.define_table('caretype', > Field('caretype', requires=IS_NOT_EMPTY(), > label=T('Caretype')), > Field('description', requires=IS_NOT_EMPTY(), > label=T('Description')), > auth.signature,format='%(description)s', migrate=False) > > added auth rows > > auth.settings.extra_fields['auth_user']= [ > Field('work_position',db.caretype, label=T('Profession')), > Field('picture', 'upload', > default='static/images/user_icon.png'),] > > Steve > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/195ef526-dad9-40fc-b627-77d3d4ff4000%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Foreign key error after adding new table instance
Hi All, Busy with my platform, just added some tables. I have defined extra fields for the Auth table. In 1 of the aded fields i use a different table to get some info. 2 days ago i added 3 row's which are available for me to select. When i add a new user i am able te select one of those rows and add the user ...NO PROBLEM Today i added 1 extre row to the referenced field, and suddenly i get an FOREIGN KEY error, and only when i select the newly added row. If i select one of the other rows ... NO PROBLEM Anyone any idea why this can happen . db.define_table('caretype', Field('caretype', requires=IS_NOT_EMPTY(), label=T('Caretype')), Field('description', requires=IS_NOT_EMPTY(), label=T('Description')), auth.signature,format='%(description)s', migrate=False) added auth rows auth.settings.extra_fields['auth_user']= [ Field('work_position',db.caretype, label=T('Profession')), Field('picture', 'upload', default='static/images/user_icon.png'),] Steve -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/ace7b99c-34b5-4e65-b9d7-7d0d6e6ae9be%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: placeholder for update record field names
Hi Anthony, Thanks, i will give it a try Op vrijdag 29 maart 2019 21:53:49 UTC+1 schreef Anthony: > > You can create a dictionary of field names and values and then do: > > workrecord.update_record(**dict_of_new_values) > > Anthony > > On Friday, March 29, 2019 at 4:49:28 PM UTC-4, Steve wrote: >> >> Hi All, >> >> When updating a record i would like to make some column names variable. >> I have the next statement : workrecord.update_record(starttime=iid.start, >> t1=worktime, c1=amount) >> >> I would like to make the field t1 variable so that ik can replace the 1 >> with another number.! >> Any a suggestion if this is possible and if so how. >> >> The %s or %d does not work on fieldnames >> >> Steve >> > -- 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: placeholder for update record field names
Hi Anthony, Thanks, i will give it a try Op vrijdag 29 maart 2019 21:53:49 UTC+1 schreef Anthony: > > You can create a dictionary of field names and values and then do: > > workrecord.update_record(**dict_of_new_values) > > Anthony > > On Friday, March 29, 2019 at 4:49:28 PM UTC-4, Steve wrote: >> >> Hi All, >> >> When updating a record i would like to make some column names variable. >> I have the next statement : workrecord.update_record(starttime=iid.start, >> t1=worktime, c1=amount) >> >> I would like to make the field t1 variable so that ik can replace the 1 >> with another number.! >> Any a suggestion if this is possible and if so how. >> >> The %s or %d does not work on fieldnames >> >> Steve >> > -- 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] placeholder for update record field names
Hi All, When updating a record i would like to make some column names variable. I have the next statement : workrecord.update_record(starttime=iid.start, t1=worktime, c1=amount) I would like to make the field t1 variable so that ik can replace the 1 with another number.! Any a suggestion if this is possible and if so how. The %s or %d does not work on fieldnames Steve -- 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] Calculation with imput from different tables
Hi all, I'm still fairly new with web2py and what to get something working but i got stuck. i have 2 tables who are prefilled with data and a form where a user can give imput,. I would like to use the imput of the user and select the right field in a different table to get the correct price and use that for a calculation. example data to work with: First dataset Part of day From: Until: Night2 0:00 7:00 Day 7:00 18:00 Evening 18:00 23:00 Night1 23:00 0:00 second dataset Job A *normal (1)* *weekend (2)* *holiday. (3)* Day 22,15 23,30 23,30 Evening 23,30 25,10 25,10 Night1 11,85 13,15 13,15 Night2 25,65 26,70 26,70 When a user fills in a form where they have to fill in a workday with start-datetime and end-datetime i would like to compare the start-datetime and end-datetime with the first and send table to define how many hours a specific person ( in a specific job) has worked is a specific part of day and multiply that with the correct number. for example: if someone works in Job A and works 2 hours during day ( between 07:00 and 18:00 ) and that day was in the weekend i would like to have a calculation in a table with value: 46,60. I know how to setup the three tables but how to compare user input with 2 different tables and write the outcome to the same table where the userinput is stored. IHope someone can point me in the right direction steve -- 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: Server does not exist or access denied error connecting web2py to MS SQL server
--- edit 20180831 --- In the light of the new morning I figured this much out. Changes: appconfig.ini--- [db] connectionstring = mssql://DRIVER={FreeTDS};SERVER=localhost;DATABASE=etl_metadata;UID=sa;PWD=d0taCell1! --- db.py--- db = DAL(configuration.get('db.connectionstring')) --- result error--- Error: (u'IM002', u'[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified') --- --- end edit --- On Thursday, August 30, 2018 at 4:49:01 PM UTC-4, Steve Lyle wrote: > > I've read the book & plenty else offered by up on the little pits > available on Prof. Google. > And I just don't get it I guess. > > I'm on a Windows 10 Pro x64 box > I'm running web2py from cmd as: > """ > cd c:\web2py > python web2py > web2py Web Framework > Created by Massimo Di Pierro, Copyright 2007-2018 > Version 2.17.1-stable+timestamp.2018.08.06.01.02.56 > Database drivers available: sqlite3, imaplib, pyodbc, pymysql > please visit: > http://127.0.0.1:8000/ > starting browser... > """ > > I do have python 2.7.15 installed as c:\python27; also have c:\anaconda3 > installed but for this purposes I break anaconda by renaming the > c:\anaconda3 to c:\X-anaconda3. > I validate that running python from cmd it is opening 2.7.15 as expected > given the environment path. > - > C:\web2py>python > Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 > bit (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>>import pypyodbc > >>> import pyodbc > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named pyodbc > >>> > - > Importing pypyodbc doesn't report any problems. > I believe the traceback below perfect proves 2.7.15 is running and > expectedly calling the pypyodbc installed within 2.7.15. > Importing pyodbc shows the error demonstrated above even thought web2py > reports it as an available driver. > > I have no problems accessing the test DB from SSMS or other applications. > SQL server is dev edition 2017. > > My web2py application is called 'init'. > > Why does this configuration of pydal fail? > What more info can I offer you in this thread to get this fixed? > Any tips appreciated. > > > > --- from applications\init\private\appconfig.ini -- > ; db configuration > [db] > uri = mssql://sa:blabla@localhost/test > migrate = true > pool_size = 10 > > > > Traceback (most recent call last): > File "C:\web2py\gluon\restricted.py", line 219, in restricted > exec(ccode, environment) > File "C:/web2py/applications/init/models/db.py", line 36, in > check_reserved=['all']) > File "C:\web2py\gluon\packages\dal\pydal\base.py", line 170, in __call__ > obj = super(MetaDAL, cls).__call__(*args, **kwargs) > File "C:\web2py\gluon\packages\dal\pydal\base.py", line 475, in __init__ > "Failure to connect, tried %d times:\n%s" % (attempts, tb) > RuntimeError: Failure to connect, tried 5 times: > Traceback (most recent call last): > File "C:\web2py\gluon\packages\dal\pydal\base.py", line 455, in __init__ > self._adapter = adapter(**kwargs) > File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, > in __call__ > obj = super(AdapterMeta, cls).__call__(*args, **kwargs) > File "C:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 31, in > __init__ > driver_args, adapter_args, do_connect, after_connection) > File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 369, in > __init__ > super(SQLAdapter, self).__init__(*args, **kwargs) > File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 53, in > __init__ > self.reconnect() > File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in > reconnect > self.connection = self.connector() > File "C:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 81, in > connector > return self.driver.connect(self.cnxn, **self.driver_args) > File "c:\Python27\lib\site-packages\pypyodbc.py", line 2454, in __init__ > self.connect(connectString, autocommit, ansi, timeout, > unicode_results, readonly) > File "c:\Python27\lib\site-packages\pypyodbc.py", line 2507, in connect > check_success(self, ret) > File "c:\Python27\lib\site-packages\pypyodbc.py", line 1009, in > check_success > ctrl_err(SQL_HANDLE_DBC
[web2py] Server does not exist or access denied error connecting web2py to MS SQL server
I've read the book & plenty else offered by up on the little pits available on Prof. Google. And I just don't get it I guess. I'm on a Windows 10 Pro x64 box I'm running web2py from cmd as: """ cd c:\web2py python web2py web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2018 Version 2.17.1-stable+timestamp.2018.08.06.01.02.56 Database drivers available: sqlite3, imaplib, pyodbc, pymysql please visit: http://127.0.0.1:8000/ starting browser... """ I do have python 2.7.15 installed as c:\python27; also have c:\anaconda3 installed but for this purposes I break anaconda by renaming the c:\anaconda3 to c:\X-anaconda3. I validate that running python from cmd it is opening 2.7.15 as expected given the environment path. - C:\web2py>python Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>import pypyodbc >>> import pyodbc Traceback (most recent call last): File "", line 1, in ImportError: No module named pyodbc >>> - Importing pypyodbc doesn't report any problems. I believe the traceback below perfect proves 2.7.15 is running and expectedly calling the pypyodbc installed within 2.7.15. Importing pyodbc shows the error demonstrated above even thought web2py reports it as an available driver. I have no problems accessing the test DB from SSMS or other applications. SQL server is dev edition 2017. My web2py application is called 'init'. Why does this configuration of pydal fail? What more info can I offer you in this thread to get this fixed? Any tips appreciated. --- from applications\init\private\appconfig.ini -- ; db configuration [db] uri = mssql://sa:blabla@localhost/test migrate = true pool_size = 10 Traceback (most recent call last): File "C:\web2py\gluon\restricted.py", line 219, in restricted exec(ccode, environment) File "C:/web2py/applications/init/models/db.py", line 36, in check_reserved=['all']) File "C:\web2py\gluon\packages\dal\pydal\base.py", line 170, in __call__ obj = super(MetaDAL, cls).__call__(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\base.py", line 475, in __init__ "Failure to connect, tried %d times:\n%s" % (attempts, tb) RuntimeError: Failure to connect, tried 5 times: Traceback (most recent call last): File "C:\web2py\gluon\packages\dal\pydal\base.py", line 455, in __init__ self._adapter = adapter(**kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 31, in __init__ driver_args, adapter_args, do_connect, after_connection) File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 369, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 53, in __init__ self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in reconnect self.connection = self.connector() File "C:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 81, in connector return self.driver.connect(self.cnxn, **self.driver_args) File "c:\Python27\lib\site-packages\pypyodbc.py", line 2454, in __init__ self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly) File "c:\Python27\lib\site-packages\pypyodbc.py", line 2507, in connect check_success(self, ret) File "c:\Python27\lib\site-packages\pypyodbc.py", line 1009, in check_success ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi) File "c:\Python27\lib\site-packages\pypyodbc.py", line 987, in ctrl_err raise DatabaseError(state,err_text) DatabaseError: (u'08001', u'[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.') -- 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] MSSQL connection
Hi guys. Newbie (of sorts) here. 20+ years in programming including Python but not for a couple of years now. But now I have the first time opportunity to build my application in web2py ~ so not a newbie but yes a web2py newbie. Any quick start guides/guide for dummys style for adapting the default application to connect to MSSQL? You reference will be appreciated. If I remember from prior python work that even though the module is call '..odbc' is doesn't really use odbc does it?!? 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] Is it safe to delete all folders from sessions? Does it have any side effect?
I need to use my app from fresh. Will it have any disadvantage? -- 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] Why isn't WEB2PY a part of Googles summer of code? Will it be this time?
I am seeing that Django, RoR all are on GSOC. Maybe web2py too should be there. -- 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: What's wrong here such that the delete query in accept() doesn't work at all?
No error, just the thing that "db((db.friend_requests. requester== auth.user_id) & (db.friend_requests.declarer== request.args[0])).delete(" doesn't seem to work in accept(). On Friday, September 23, 2016 at 7:04:52 PM UTC+5:30, Anthony wrote: > > First, you should move all of that logic out of the view and into a > controller. Have the controller generate a URL and a message, and just pass > the URL and message to the view. This will make the code much easier to > read, test, and debug. > > Second, if you just need to check whether some records exist, use > db(query).isempty(), which ultimately calls .count() -- this is more > efficient than unnecessarily retrieving and parsing all the actual records. > > Regarding your question, please explain further what you mean by "doesn't > work". Do you receive an error? If so, let's see the traceback. Otherwise, > what do you expect, and what do you observe instead? It would probably also > help to show the controller code of the main page, and possibly relevant > parts of your models. > > Anthony > > On Friday, September 23, 2016 at 7:13:20 AM UTC-4, Steve Joe wrote: >> >> in view: >> >> {{if not (authdetails.id==auth.user_id):}} >> {{if db((db.friends.friend1==auth.user_id) & (db.friends.friend2== >> authdetails.id)).select() or db((db.friends.friend2==auth.user_id) & >> (db.friends.friend1==authdetails.id)).select():}} >> >> YOU BOTH ARE FRIENDS. >> >> {{elif db((db.friend_requests.requester==auth.user_id) & >> (db.friend_requests.declarer==authdetails.id)).select():}} >> >> Your friend request is yet to be confirmed by this user. > href="{{=URL('user','deletefr', args=[authdetails.id, >> username])}}">DELETE Friend request. >> >> {{elif db((db.friend_requests.requester==authdetails.id) & >> (db.friend_requests.declarer==auth.user_id)).select():}} >> THIS PERSON SENT YOU A FRIEND REQUEST. ACCEPT FRIEND REQUEST >> {{else:}} >> ADD THIS PERSON TO YOUR CIRCLE >> {{pass}} >> >> in controller: >> def addtocircle(): >> db.friend_requests.insert(requester= auth.user_id, declarer= >> request.args[0]) >> redirect(URL('user','index', args=request.args[1])) >> >> def deletefr(): >> db((db.friend_requests.requester== auth.user_id) & >> (db.friend_requests.declarer== request.args[0])).delete() >> redirect(URL('user','index', args=request.args[1])) >> def accept(): >> db((db.friend_requests.requester== auth.user_id) & >> (db.friend_requests.declarer== request.args[0])).delete() >> db.friends.insert(friend1 = auth.user_id, friend2 = request.args[0]) >> redirect(URL('user','index', args=request.args[1])) >> >> >> everything except the first statement in accept for deletion doesn't work >> which should actually work because the same works for deletefr() too! >> > -- 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] What's wrong here such that the delete query in accept() doesn't work at all?
in view: {{if not (authdetails.id==auth.user_id):}} {{if db((db.friends.friend1==auth.user_id) & (db.friends.friend2==authdetails.id)).select() or db((db.friends.friend2==auth.user_id) & (db.friends.friend1==authdetails.id)).select():}} YOU BOTH ARE FRIENDS. {{elif db((db.friend_requests.requester==auth.user_id) & (db.friend_requests.declarer==authdetails.id)).select():}} Your friend request is yet to be confirmed by this user. DELETE Friend request. {{elif db((db.friend_requests.requester==authdetails.id) & (db.friend_requests.declarer==auth.user_id)).select():}} THIS PERSON SENT YOU A FRIEND REQUEST. ACCEPT FRIEND REQUEST {{else:}} ADD THIS PERSON TO YOUR CIRCLE {{pass}} in controller: def addtocircle(): db.friend_requests.insert(requester= auth.user_id, declarer= request.args[0]) redirect(URL('user','index', args=request.args[1])) def deletefr(): db((db.friend_requests.requester== auth.user_id) & (db.friend_requests.declarer== request.args[0])).delete() redirect(URL('user','index', args=request.args[1])) def accept(): db((db.friend_requests.requester== auth.user_id) & (db.friend_requests.declarer== request.args[0])).delete() db.friends.insert(friend1 = auth.user_id, friend2 = request.args[0]) redirect(URL('user','index', args=request.args[1])) everything except the first statement in accept for deletion doesn't work which should actually work because the same works for deletefr() too! -- 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] How do I make this button redirect to a controller function when enter is pressed?
document.getElementById("search") .addEventListener("keyup", function(event) { event.preventDefault(); if (event.keyCode == 13) { document.getElementById("searchbutton").click(); } }); I see that neither enter works nor search.text is correct at this context. How should I correct 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.
Re: [web2py] Re: I am trying to login from Phonegap app into my web2py app, what's wrong here?
db((db.auth_user.username == request.vars.username) & (db.auth_user.password == CRYPT(digest_alg='pbkdf2(1000,20,sha512)')(request.vars.password)[0])).select() this doesn't work at all too. On Saturday, August 27, 2016 at 5:44:53 PM UTC+5:30, Kiran Subbaraman wrote: > > The book can help you: > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Logical-operators > You need to use the right operator in your query > You can also use the web2py debugger to figure out how your code works and > values returned, at runtime. > > > Kiran Subbaramanhttp://subbaraman.wordpress.com/about/ > > On Sat, 27-08-2016 2:50 PM, Steve Joe wrote: > > Anyone there? Anthony? > > On Friday, August 26, 2016 at 7:38:40 PM UTC+5:30, Steve Joe wrote: >> >> *db(db.auth_user.username == request.vars.username and >> db.auth_user.password == CRYPT(request.vars.password)).select()* >> >> >> *if db(db.auth_user.username == request.vars.username and >> db.auth_user.password == >> CRYPT(digest_alg='md5')(request.vars.password)[0]).select(): * >> >> Both of them don't work either. >> >> On Friday, August 26, 2016 at 7:30:41 PM UTC+5:30, Niphlod wrote: >>> >>> fortunately the password doesn't get stored in plain text on web2py :D >>> You need to apply CRYPT() before comparing. Read more about that on the >>> book. >>> >>> On Friday, August 26, 2016 at 3:31:54 PM UTC+2, Steve Joe wrote: >>>> >>>> IN PHONEGAP: >>>> >>>> https://#someurl#. >>>> pythonanywhere.com/welcome/phonegap/login"> >>>> username: >>>> >>>> >>>> Password: >>>> >>>> >>>> >>>> >>>> >>>> >>>> IN WEB2PY: >>>> >>>> def login(): >>>> k="false" >>>> if db(db.auth_user.username == request.vars.username and >>>> db.auth_user.password == request.vars.password).select(): >>>> k="true" >>>> return locals() >>>> >>>> and in view I can see: >>>> >>>> false >>>> which means I got k as false. >>>> >>>> The username and pasword are correct according to my database but I >>>> can't login. What should I do? >>>> >>> -- > 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+un...@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: I am trying to login from Phonegap app into my web2py app, what's wrong here?
Anyone there? Anthony? On Friday, August 26, 2016 at 7:38:40 PM UTC+5:30, Steve Joe wrote: > > *db(db.auth_user.username == request.vars.username and > db.auth_user.password == CRYPT(request.vars.password)).select()* > > > *if db(db.auth_user.username == request.vars.username and > db.auth_user.password == > CRYPT(digest_alg='md5')(request.vars.password)[0]).select():* > > Both of them don't work either. > > On Friday, August 26, 2016 at 7:30:41 PM UTC+5:30, Niphlod wrote: >> >> fortunately the password doesn't get stored in plain text on web2py :D >> You need to apply CRYPT() before comparing. Read more about that on the >> book. >> >> On Friday, August 26, 2016 at 3:31:54 PM UTC+2, Steve Joe wrote: >>> >>> IN PHONEGAP: >>> >>> https://#someurl#. >>> pythonanywhere.com/welcome/phonegap/login"> >>> username: >>> >>> >>> Password: >>> >>> >>> >>> >>> >>> >>> IN WEB2PY: >>> >>> def login(): >>> k="false" >>> if db(db.auth_user.username == request.vars.username and >>> db.auth_user.password == request.vars.password).select(): >>> k="true" >>> return locals() >>> >>> and in view I can see: >>> >>> false >>> which means I got k as false. >>> >>> The username and pasword are correct according to my database but I >>> can't login. What should I do? >>> >> -- 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: I am trying to login from Phonegap app into my web2py app, what's wrong here?
*db(db.auth_user.username == request.vars.username and db.auth_user.password == CRYPT(request.vars.password)).select()* This also doesn't work either. On Friday, August 26, 2016 at 7:30:41 PM UTC+5:30, Niphlod wrote: > > fortunately the password doesn't get stored in plain text on web2py :D You > need to apply CRYPT() before comparing. Read more about that on the book. > > On Friday, August 26, 2016 at 3:31:54 PM UTC+2, Steve Joe wrote: >> >> IN PHONEGAP: >> >> https://#someurl#.pythonanywhere.com/welcome/phonegap/login >> "> >> username: >> >> >> Password: >> >> >> >> >> >> >> IN WEB2PY: >> >> def login(): >> k="false" >> if db(db.auth_user.username == request.vars.username and >> db.auth_user.password == request.vars.password).select(): >> k="true" >> return locals() >> >> and in view I can see: >> >> false >> which means I got k as false. >> >> The username and pasword are correct according to my database but I can't >> login. What should I do? >> > -- 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] I am trying to login from Phonegap app into my web2py app, what's wrong here?
IN PHONEGAP: https://#someurl#.pythonanywhere.com/welcome/phonegap/login;> username: Password: IN WEB2PY: def login(): k="false" if db(db.auth_user.username == request.vars.username and db.auth_user.password == request.vars.password).select(): k="true" return locals() and in view I can see: false which means I got k as false. The username and pasword are correct according to my database but I can't login. What should I do? -- 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] How should I tackle this error?
def index(): display=SQLFORM(db.dp ,point.id, showid=False, submit_button="Update" ).process() if display.accepted: redirect(URL('you','resizedp', args=auth.user_id)) return locals() def resizedp(): display=db(db.dp.user_id == auth.user_id).select().first() from PIL import Image im1=Image.open(display.pic); im1=im1.resize((im1.size[0]*10/(im1.size[0]*im1.size[1]),im1.size[1]*10/(im1.size[0]*im1.size[1])), Image.ANTIALIAS); im1.save(display.pic) error : [Errno 2] No such file or directory: 'dp.pic.be8ef2561c63bcae.66616e2e6a7067.jpg' although I can see such an image in the uploads folder. -- 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: How to ensure that the upload field only accepts .jpg or .png files?
Thank you Annet. What should I do for pdf? On Saturday, August 20, 2016 at 5:53:18 PM UTC+5:30, Annet wrote: > > Use the IS_IMAGE() validator > > http://web2py.com/books/default/chapter/29/07/forms-and-validators#IS_IMAGE > > > requires = IS_IMAGE(extensions=('jpg', 'png')) > > > > > Kind regards, > > Annet > -- 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] How do I send a pdf as json object saved in the web2py db?
How would you do 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] What's wrong with this snippet as it's not giving the correct result?
db((db.user_interests.user_id == auth.user_id) and (db.user_interests.interest == nosubscription.category)).select() -- 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] How to ensure that the upload field only accepts .jpg or .png files?
What is the exact snippet for the same? -- 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: How do I make user redirect to a different page you/index instead of predefined on clicking PROFILE?
Please look at the attached image above. I want to go to page you/index upon clicking "Profile'. On Wednesday, August 17, 2016 at 6:26:16 PM UTC+5:30, Ron Chatterjee wrote: > > Can you elaborate the problem better? What exactly u trying to solve. Give > a url structure of before n after u want to see? -- 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: How do I make user redirect to a different page you/index instead of predefined on clicking PROFILE?
anyone there? On Tuesday, August 16, 2016 at 9:58:34 AM UTC+5:30, Steve Joe wrote: > > > -- 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] How do I make user redirect to a different page you/index instead of predefined on clicking PROFILE?
-- 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: How to get Month name instead of month number
Works like a charm thanks for your quick reply Steve Op zaterdag 18 juni 2016 23:43:14 UTC+2 schreef Steve: > > Goodevening, > > I loop through rows and am trying to show a date format like: 23 april. > What i get is : 23 4 ( as expected) and i would like to convert the month > number to a month name. > > this is the code that i have so far: > > {{for row in db(db.t_appointment.created_by== > auth.user.id).select(orderby=~db.t_appointment.created_on):}} > > > {{=row.f_start_time.day}} > {{=row.f_start_time.month}} >class="day">{{=row.f_start_time.hour}}:{{=row.f_start_time.minute}} > > > {{=row.f_title}} > {{=row.f_log}} > > >{{pass}} > > this works fine except month name ... not able to convert number to name > > hope that someone can help me... > > steve > -- 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] How to get Month name instead of month number
Goodevening, I loop through rows and am trying to show a date format like: 23 april. What i get is : 23 4 ( as expected) and i would like to convert the month number to a month name. this is the code that i have so far: {{for row in db(db.t_appointment.created_by==auth.user.id).select(orderby=~db.t_appointment.created_on):}} {{=row.f_start_time.day}} {{=row.f_start_time.month}} {{=row.f_start_time.hour}}:{{=row.f_start_time.minute}} {{=row.f_title}} {{=row.f_log}} {{pass}} this works fine except month name ... not able to convert number to name hope that someone can help me... steve -- 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] Though I changed datetime format to %d-%m-%Y %H:%M in web2py_ajax.html it gives the old results?
Do I have to change it anywhere else too? -- 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] How do I redirect to a different application from one application?
I know how redirect works. But I am not sure how to redirect to another app on the same web2py site. i dont want to put long url , something like this: redirect("http://127.0.0.1:8000/port/;) as it looks so naive On Friday, June 17, 2016 at 12:28:06 PM UTC+5:30, Manuele wrote: > > Il 17/06/16 08:20, Steve Joe ha scritto: > > exact syntax? > > Have you looked for it in the doc? > > > http://www.web2py.com/books/default/chapter/29/04/the-core?#HTTP-and-redirect > > http://www.web2py.com/books/default/chapter/29/04/the-core#URL > > Cheers > > M. > > -- 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] How do I sort a list containing the rows of a db query according to a db table field?
def index(): skills=db(db.skills.id>0).select() pro_lang=[] fake=[] for skill in skills: if skill.skilltype=="Programming Languages": pro_lang.append(skill) else: fake.append(skill) # how do i sort both the arrays as per the field skill.comfort ? return locals() -- 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] How do I redirect to a different application from one application?
exact syntax? -- 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] How to add a Facebook like to a field in a db table, such that 1 like increases it by one?
How do I code 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] Re: Why is my code not working? What correction has to be made?
Thank you Anthony, it worked! On Sunday, June 12, 2016 at 6:42:10 AM UTC+5:30, Anthony wrote: > > Actually, I'm not sure whether the "#" + id query selector will work if id > is a number (even if converted to a string), so you might be better off > pre-pending the id with a letter. > > Anthony > > On Saturday, June 11, 2016 at 9:02:20 PM UTC-4, Anthony wrote: >> >> You're probably getting an error in the JS console. The ajax() function >> expects id to be a string, so try: >> >> ajax('{{=URL('default','deciser')}}' + '?at=' + id, [], id.toString()) >> >> Anthony >> >> On Saturday, June 11, 2016 at 11:41:40 AM UTC-4, Steve Joe wrote: >>> >>> It does nothing. >>> However in >>> function change(id) >>> { >>> >>> ajax('{{=URL('default','deciser')}}'+'?at='+id,[],id); >>> } >>> >>> when I change the second id to something '12' as in >>> function change(id) >>> { >>> >>> ajax('{{=URL('default','deciser')}}'+'?at='+id,[],'12'); >>> } >>> it works as expected. But when it id it doesn't show any response. >>> Something's wrong there and I am unable to fix it. >>> On Friday, June 10, 2016 at 7:35:39 PM UTC+5:30, Anthony wrote: >>>> >>>> In the browser network tab, what's happening with the Ajax requests? >>>> Are they being sent as expected, and if so, what response is returned? >>>> >>>> On Friday, June 10, 2016 at 8:14:55 AM UTC-4, Steve Joe wrote: >>>>> >>>>> in .load file: >>>>> {{for i in range(0,3):}} >>>>> {{for j in range(0,3):}} >>>>> {{idd=str(i+1)+str(j+1)}} >>>>> >>>>> >>>>> {{=l[i][j]}} >>>>> >>>>> {{pass}} >>>>> >>>>> {{pass}} >>>>> >>>>> >>>>> function change(id) >>>>> { >>>>> >>>>> ajax('{{=URL('default','deciser')}}'+'?at='+id,[],id); >>>>> } >>>>> >>>>> >>>>> >>>>> >>>>> def deciser(): >>>>> return request.vars.at >>>>> >>>>> def addgameplay(): >>>>> l=[] >>>>> temp=[] >>>>> for i in range(0,3): >>>>> for j in range(0,3): >>>>> temp.append('__') >>>>> l.append(temp) >>>>> temp=[] >>>>> return locals() >>>>> >>>>> >>>>> in the function where .load has to run: >>>>> {{extend 'layout.html'}} >>>>> {{=LOAD('default', 'addgameplay.load', ajax=True)}} >>>>> >>>>> def gameplay(): >>>>> >>>>> return locals() >>>>> >>>>> >>>>> >>>>> *It does nothing! It doesn't update the id. I did some debugging and >>>>> found that the id isn't passing correctly! How do I correct 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] Why doesn't form accept the hidden fields as vars here?
Please look at my code and let me know why I am getting emails in such a way: db.define_table('pokes', Field('name',requires=IS_NOT_EMPTY(error_message="Please enter your name")), Field('email_id',requires=IS_EMAIL()), Field('msg','text', label='Message'), Field('device',default=device), Field('date_time','datetime',default=request.utcnow+datetime.timedelta(0,19800)) ) In controller: form=SQLFORM(db.messages, fields=['name', 'email_id','msg']).process() if form.accepted: mail.send(['m...@raghibrm.in'], 'A new message on your EPORTFOLIO!', '%s said:%sHis/her email id: %sLogged in from %sMessage sent at: %s' %(str(form.vars.name), str(form.vars.msg), str(form.vars.email_id), str(form.vars.device), str(form.vars.date_time))) However in db values are being inserted correctly. EMAIL THAT I AM GETTING: .kmk said: ljk, His/her email id: m...@jj.com Logged in from None Message sent at: None -- 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 is my code not working? What correction has to be made?
It does nothing. However in function change(id) { ajax('{{=URL('default','deciser')}}'+'?at='+id,[],id); } when I change the second id to something '12' as in function change(id) { ajax('{{=URL('default','deciser')}}'+'?at='+id,[],'12'); } it works as expected. But when it id it doesn't show any response. Something's wrong there and I am unable to fix it. On Friday, June 10, 2016 at 7:35:39 PM UTC+5:30, Anthony wrote: > > In the browser network tab, what's happening with the Ajax requests? Are > they being sent as expected, and if so, what response is returned? > > On Friday, June 10, 2016 at 8:14:55 AM UTC-4, Steve Joe wrote: >> >> in .load file: >> {{for i in range(0,3):}} >> {{for j in range(0,3):}} >> {{idd=str(i+1)+str(j+1)}} >> >> >> {{=l[i][j]}} >> >> {{pass}} >> >> {{pass}} >> >> >> function change(id) >> { >> >> ajax('{{=URL('default','deciser')}}'+'?at='+id,[],id); >> } >> >> >> >> >> def deciser(): >> return request.vars.at >> >> def addgameplay(): >> l=[] >> temp=[] >> for i in range(0,3): >> for j in range(0,3): >> temp.append('__') >> l.append(temp) >> temp=[] >> return locals() >> >> >> in the function where .load has to run: >> {{extend 'layout.html'}} >> {{=LOAD('default', 'addgameplay.load', ajax=True)}} >> >> def gameplay(): >> >> return locals() >> >> >> >> *It does nothing! It doesn't update the id. I did some debugging and >> found that the id isn't passing correctly! How do I correct 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] Why is my code not working? What correction has to be made?
in .load file: {{for i in range(0,3):}} {{for j in range(0,3):}} {{idd=str(i+1)+str(j+1)}} {{=l[i][j]}} {{pass}} {{pass}} function change(id) { ajax('{{=URL('default','deciser')}}'+'?at='+id,[],id); } def deciser(): return request.vars.at def addgameplay(): l=[] temp=[] for i in range(0,3): for j in range(0,3): temp.append('__') l.append(temp) temp=[] return locals() in the function where .load has to run: {{extend 'layout.html'}} {{=LOAD('default', 'addgameplay.load', ajax=True)}} def gameplay(): return locals() *It does nothing! It doesn't update the id.* -- 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] How do I change the admin such that it doesn't redirect to welcome by default but to some other app?
How do I change the admin such that it doesn't redirect to welcome by default but to some other app? -- 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] Any body here used pythonanywhere? Question for you.
Apart from 'welcome' how many web apps can you hostel to a domain name say, mystyle.com, at max? -- 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] How do I host my web2py app on openshift?
any stepwise procedure? -- 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] This query doesn't fulfill what I need as it doesn't follow first condition? How to correct?
rides=db(db.carpools.start_time > request.utcnow+datetime.timedelta(0,19800) and db.carpools.starter!=auth.user_id).select() -- 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: auth.signature and Format ....issue
What do you mean by first extending auth ... Before referencing it... if i do so then i get an atrribute error. See here a snippet of my code which works in this order but auth.signature ( because i reference to auth.signature before i define my auth tables? ) -- from gluon.tools import Auth, Service, PluginManager auth = Auth(db) service = Service() plugins = PluginManager() ## adding custom fields to Auth_user table db.define_table('work_position', Field('Name',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Name')), format='%(Name)s') db.define_table('practice', Field('Name',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Name')), format='%(Name)s') auth.settings.extra_fields['auth_user']= [ Field('work_position', db.work_position, label=T('Profession')), Field('practice', db.practice, label=T('Practice')), Field('Reg_number',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Registration Number')),] ## create all tables needed by auth if not custom tables auth.define_tables(username=False, signature=False) ## configure auth policy auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True auth.settings.actions_disabled=['register'] Op woensdag 1 juni 2016 16:06:10 UTC+2 schreef Niphlod: > > at a minimum you need to extend auth BEFORE referencing it. and where is > your auth.define_tables() call ? > > On Wednesday, June 1, 2016 at 3:00:50 PM UTC+2, Steve wrote: >> >> Hi, >> >> I am trying to extend the Auth_user tabel with a dropdown field. >> >> I have them working but if i try to add the "Auth.signature" in Db.py to >> the table "work_position" i get an error message. >> error message: >> 'Cannot resolve reference auth_user in >> work_position definition' >> >> >> >> - >> from gluon.tools import Auth, Service, PluginManager >> >> auth = Auth(db) >> service = Service() >> plugins = PluginManager() >> >> ## adding custom fields to Auth_user table >> db.define_table('work_position', >> Field('Name',requires=IS_NOT_EMPTY(error_message='cannot >> be empty!'), label=T('Name')), >> auth.signature, >> format='%(Name)s') >> >> auth.settings.extra_fields['auth_user']= [ >> Field('work_position', db.work_position, >> label=T('Profession')), >> etc >> >> Anyone an idea to solve this ? >> Without the auth.signature it works fine. >> >> steve >> > -- 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] Does the code below the raise execute or it terminates at raise?
-- 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] auth.signature and Format ....issue
Hi, I am trying to extend the Auth_user tabel with a dropdown field. I have them working but if i try to add the "Auth.signature" in Db.py to the table "work_position" i get an error message. error message: 'Cannot resolve reference auth_user in work_position definition' - from gluon.tools import Auth, Service, PluginManager auth = Auth(db) service = Service() plugins = PluginManager() ## adding custom fields to Auth_user table db.define_table('work_position', Field('Name',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Name')), auth.signature, format='%(Name)s') auth.settings.extra_fields['auth_user']= [ Field('work_position', db.work_position, label=T('Profession')), etc Anyone an idea to solve this ? Without the auth.signature it works fine. steve -- 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] I am trying to establish a startup in India that designs sites using web2py. Have a look here.
I am designing the main website. Meanwhile I created the Facebook page for it. Have a look here and please give me some tips based on my posts. https://www.facebook.com/techavocado/ -- 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] I think I can make websites now with web2py but is there any scope for freelancing?
I see everyone wants php -- 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] Which free email service works fine with web2py?
I used to use gmail. Had a lot of struggle and one fine day it started working. Now again it doesn't work. I get no emails! -- 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: I tried learning scheduler but got messed up. Can someone help me with this?
No it didn't add anything to the db checker. I made a few edits. I am not sure how they are working but they still don't work. scheduler.queue_task(adder, start_time=request.now, #datetime stop_time = None, #datetime timeout = 60, #seconds prevent_drift=False, period=60, #seconds immediate=False, repeats = 1 ) what's the definition between each of the parameters I used (I know I'm too dumb to not get that) and why is my code not inserting anything to checker? On Sunday, May 15, 2016 at 1:00:42 AM UTC+5:30, Alfonso Serra wrote: > > Its just doing what you told it. Inserting a record each time it runs. So > ye, its working. Just make sure to tell it how long it should pass between > executions. > -- 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: I tried learning scheduler but got messed up. Can someone help me with this?
in my db1.py: db.define_table('checker', Field('name'), Field('timenow', default=request.now.time()) ) def adder(): db.checker.insert(name="gobo") from gluon.scheduler import Scheduler scheduler=Scheduler(db) somewhere in my controller: if accept==1: task=scheduler.queue_task(adder) I intend to insert entries defined in function adder every 60 seconds but this isn't working. Am I missing something? Are all codes here correct or not? On Saturday, May 14, 2016 at 11:48:42 PM UTC+5:30, Anthony wrote: > > Always helps to show what you have tried so far, and explain what happened. > > On Saturday, May 14, 2016 at 5:38:57 AM UTC-4, Steve Joe wrote: >> >> how to write a scheduler function that will send me an email with subject >> "hello" every night at 12 am? >> > -- 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: I tried learning scheduler but got messed up. Can someone help me with this?
in my db1.py: db.define_table('checker', Field('name'), Field('timenow', default=request.now.time()) ) def adder(): db.checker.insert(name="gobo") from gluon.scheduler import Scheduler scheduler=Scheduler(db) task=scheduler.queue_task(adder) I intend to insert entry defined in function adder every 60 secs but it doesn't work. Instead scheduler_task db is getting flooded! Why's that happening? On Saturday, May 14, 2016 at 11:48:42 PM UTC+5:30, Anthony wrote: > > Always helps to show what you have tried so far, and explain what happened. > > On Saturday, May 14, 2016 at 5:38:57 AM UTC-4, Steve Joe wrote: >> >> how to write a scheduler function that will send me an email with subject >> "hello" every night at 12 am? >> > -- 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] I tried learning scheduler but got messed up. Can someone help me with this?
how to write a scheduler function that will send me a message with subject "hello" every night at 12 am? -- 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: Are web2py apps safe from xss attacks?
Saw it. Have a last doubt. Does web2py avoid file inclusion vulnerability? How? On Friday, May 13, 2016 at 8:31:49 PM UTC+5:30, Anthony wrote: > > Have a look here: > http://web2py.com/books/default/chapter/29/01/introduction#Security > > On Friday, May 13, 2016 at 10:20:29 AM UTC-4, Steve Joe wrote: >> >> That's fine. How about SQL injection? Is it safe from it? >> >> On Friday, May 13, 2016 at 2:17:59 AM UTC+5:30, Anthony wrote: >>> >>> As long as you're allowed to write your own code, nothing is safe, but >>> one thing web2py does to help protect against XSS attacks is to >>> automatically escape all content inserted in views. >>> >>> Anthony >>> >>> On Thursday, May 12, 2016 at 4:14:00 PM UTC-4, Steve Joe wrote: >>>> >>>> how? >>> >>> -- 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] I have a file 'you.html' in static, how do I open it in my web2py app?
I tried the following but it didn't work. in controller: def rough(): import os file = open(os.path.join(request.folder, 'static','index.html')) return locals() in view: {{extend 'layout.html'}} {{=file}} -- 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: Are web2py apps safe from xss attacks?
That's fine. How about SQL injection? Is it safe from it? On Friday, May 13, 2016 at 2:17:59 AM UTC+5:30, Anthony wrote: > > As long as you're allowed to write your own code, nothing is safe, but one > thing web2py does to help protect against XSS attacks is to automatically > escape all content inserted in views. > > Anthony > > On Thursday, May 12, 2016 at 4:14:00 PM UTC-4, Steve Joe wrote: >> >> how? > > -- 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] Are web2py apps safe from xss attacks?
how? -- 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] How to take javascript variables from one view to a different view?
can u write syntax for the same? -- 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] How to take javascript variables from one view to a different view using ?
syntax for the same? -- 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: How do I update only the last row of a db query?
Thank you for pointing that out Niphlod. So how should I correct it? On Wednesday, May 11, 2016 at 5:37:43 PM UTC+5:30, Niphlod wrote: > > yep. you need to FILTER before APPLYing the update. it's rather easy to > spot the error because last() comes AFTER update(). > > On Wednesday, May 11, 2016 at 1:15:45 PM UTC+2, Steve Joe wrote: >> >> db(db.loc_data.school_id == >> auth.user_id).update(end_time=request.utcnow+datetime.timedelta(0,19800) >> ).last() >> >> this doesn't tend to work. >> > -- 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] How do I update only the last row of a db query?
db(db.loc_data.school_id == auth.user_id).update(end_time=request.utcnow+datetime.timedelta(0,19800) ).last() this doesn't tend to work. -- 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] Which payment gateway works best with web2py for india based website?
how much does it cost? -- 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] I removed navbar from layout and implemented in view like this but I don't get toggle in mobile view
I want toggle navigation button when opened from mobile and not like this. My code in index.html: {{if response.menu:}} {{=response.logo or ''}} {{=MENU(response.menu, _class='nav navbar-nav',li_class='dropdown',ul_class='dropdown-menu')}} {{pass}} {{='auth' in globals() and auth.navbar('Welcome',mode='dropdown') or ''}} I had removed the following from layout.html: Toggle navigation {{=response.logo or ''}} {{='auth' in globals() and auth.navbar('Welcome',mode='dropdown') or ''}} {{if response.menu:}} {{=MENU(response.menu, _class='nav navbar-nav',li_class='dropdown',ul_class='dropdown-menu')}} {{pass}} -- 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: How to add payment integration in web2py?
But the code for stripe is only for credit cards. What about debit cards and net banking? -- 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] Someone tell me what's wrong here?
auth = Auth(db) auth.user_email.readable=False auth.user_email.writable=False -- 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: How to change login form such that it will ask the field username (added to auth) instead of email?
I did the following and it works. Is there anything which I am losing? auth = Auth(db) auth.settings.extra_fields['auth_user']= [Field('username', requires=[IS_NOT_EMPTY(), IS_LENGTH(minsize=6, maxsize=15)], unique=True)] auth.define_tables(username=False, signature=False) custom_auth_table=db[auth.settings.table_user_name] custom_auth_table.email.readable=False custom_auth_table.email.writable=False On Tuesday, April 19, 2016 at 9:21:43 PM UTC+5:30, Anthony wrote: > > You should not be adding your own "username" field to Auth. Instead, just > do: > > auth.define_tables(username=True) > > or alternatively: > > auth.settings.use_username = True > auth.define_tables() > > If that case, the registration and login forms will automatically include > the username field. > > Anthony > > On Tuesday, April 19, 2016 at 6:32:59 AM UTC-4, Steve Joe wrote: >> >> username field is also unique >> > -- 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] What is the difference between the both?
ajax('{{=URL("default","data")}}',[],'target'); where target is id of a div and ajax('{{=URL("default","data")}}',[],':eval); How do their functionality differ? -- 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] How to change login form such that it will ask the field username (added to auth) instead of email?
username field is also unique -- 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] What's wrong in this syntax?
in db.py: auth.settings.extra_fields['auth_user']= [Field('last_active', default=request.utcnow+datetime.timedelta(0,19800), readable=False, writable=False), Field('last_seen', default=request.utcnow+datetime.timedelta(0,19800), readable=False, writable=False)] in controller person=db(db.auth_user.id==5).select().first() ostatus=False cmp=person.last_seen datetime.datetime.strptime(cmp, "%Y-%m-%d %H:%M:%S") cmp=cmp+datetime.timedelta(0,600) if cmp>= request.utcnow+datetime.timedelta(0,19800): ostatus=True the controller gives me error continuously -- 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: How to compare between two datetime in web2py?
in db,py auth.settings.extra_fields['auth_user']= [Field('last_active', default=request.utcnow+datetime.timedelta(0,19800), readable=False, writable=False), Field('last_seen', default=request.utcnow+datetime.timedelta(0,19800), readable=False, writable=False)] in controller for person in people: s1=str(person.last_active) s2=str(person.last_seen) from datetime import datetime datetime1 = s2 datetime1 = datetime.strptime(datetime1, "%Y-%m-%d %H:%M:%S.%f") # Converts string to datetime object datetime2 = request.utcnow+datetime.timedelta(0.19800) difference = (datetime1 - datetime2).seconds # Difference between the two datetimes in seconds temp="%d. %sLast activity at:%sLast seen at:%s with diff: %s"%(i,str(person.first_name) +" "+str(person.last_name), s1[:int((s1.index('.') ))], s2[:int((s2.index('.') ))], str(datetime2) ) i=i+1 peoplelist.append(temp) return peoplelist this one gives me an error. how to correct? On Tuesday, April 19, 2016 at 12:18:21 PM UTC+5:30, mfarees...@gmail.com wrote: > > from datetime import datetime > > > datetime1 = "2016-04-19 01:25:09.9090" > datetime1 = datetime.strptime(datetime1, "%Y-%m-%d %H:%M:%S.%f") # Converts > string to datetime object > > datetime2 = "2016-04-19 01:25:09.8765" > datetime2 = datetime.strptime(datetime2, "%Y-%m-%d %H:%M:%S.%f") # Converts > string to datetime object > > difference = (datetime1 - datetime2).seconds # Difference between the two > datetimes in seconds > > result = True if difference == 4 else False > > > -- 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] How to ensure each row in the db table having distinct value of a partcular field?
db.define_table('person', Field('name'), Field('dob','datetime'), Field('username') #has to be unique ) how to ensure that the field username is unique? -- 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] How to compare between two datetime in web2py?
suppose I have two datetime as following. Now how do I compare between both and return true if time gap between both is 4 seconds or not. I am confused because they are none type objects so how to compare them? 2016-04-19 01:25:09.9090 2016-04-19 01:25:09.8765 -- 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] What is the difference between request.args and request.vars in web2py?
example? -- 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: How should I handle this?
if auth.user_id <1: redirect(URL('default','index'), client_side=True) Why this isn't working? On Sunday, April 17, 2016 at 3:37:31 PM UTC+5:30, Leonel Câmara wrote: > > add client_side=True to the redirect calls > > redirect("http://google.com;, client_side=True) > -- 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] Can we write a func such that a variable will have value 1 for a mint and again value 0?
what's the syntax? -- 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] How should I handle this?
def data(): if auth.user_id==0: redirect("http://google.com;) rows=0 if request.vars.q: db.chats.insert(shouter=auth.user and auth.user.first_name, msg=request.vars.q) size=len(db(db.chats.id>0).select()) lower=size-8 if size-8<=0: lower=0 rows=db(db.chats.id>0).select(limitby=(lower, size)) chatlist=[] for row in rows: shout=" %s : %s %s " % (str(row.shouter), str(row.msg), str(row.date_time)) chatlist.append(shout) return chatlist in view: {{extend 'layout.html'}} I want to redirect the whole page to some arbitrary website if ajax call finds that it is not logged in...how do I do that.. i dont want to do it in def index() function, i want to do it in function that ajax calls -- 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] Is there anything wrong with this syntax? Related with quotes inside quotes?
-- 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] What's wrong here?
I am trying to show the user the recent 6 db entries at every 5 secs. But it doesn't seem to work! What am I doin wrong here? view:
[web2py] How to call an ajax process for controller function from script in the view? What's wrong here?
window.setInterval(function(){ajax('{{=URL('data')}}',['q'],'target');}, 5000); -- 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] How to invoke this ajax process every 5 secs?
so here when one gives some value, it will be displayed in the div id=target. However this is a chat room, so one has to see what others have too to say. So how do I invoke the ajax process to refresh the div id=target? -- 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] How to check whether an auth.user is online?
What's the syntax? -- 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] incorporate response.menu in a bootstrap3 side-menu
Goodevening, I have already a working Bootstrap login screen and a new Bootstrap layout Plugin template working but ... I am struggeling to get the sidebar working with response.menu and my main problem is to get the classes and styling correct. Think that has to do with the standard class which response.menu invokes . Can someone help me to get this working ? In the code below i would like to incorporate the response.menu but keep the classes and styling of the existing menu. example side-bar menu: General Home General Form Advanced Components Form Validation Form Wizard Form Upload Form Buttons etc Steve -- 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] add value to dropdown list
Goodevening, I have a question about using a dropdown list. What i would like is that someone can select an item from a dropdown list ( so far so good) but when the item is not available i would like the oppotunity to add the item to the list. It would be nice that after adding itm to the list that the already prefilled form is still there.. Any idea how to get this working steve -- 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: FORM or SQLFORM
Massimo, Thanks, i am still getting to know web2py. and i am going through the documentation I guess i will go for the second option :-) Steve Op vrijdag 9 januari 2015 05:46:59 UTC+1 schreef Massimo Di Pierro: You have to options. You can use custom widgets to represent for example options in integer fields as buttons or images. The problem is that I do not know where the names of those options (or images) came from.. are they constants? Are they from a lookup table? It may be easier to make the fields hidden and create an interface manually in HTML and jQuery. Massimo On Tuesday, 6 January 2015 17:09:53 UTC-6, Steve wrote: Goodevening, Just started with web2py, looked at some of the web2py videos from Massimo ( which i find very good). Still , i need some pointers to start with a specific page / form and hope that someone can help me with this. Not sure if i should use FORM or SQLFORM and also if i should put al the information in one table or one or more reference tables ( what is good practice). Example of the form i would like to build: 1) Button A, Button B, Button C and a field where someone can fill in a INT ( user selects a value trough one of the buttons or fills in the free field -- Show the selection the user made 2) Select a Image from different images -- Show the selected Image -- 3) Select the delivery : Email, SMS or Print - When the selection at nr. 3 is Email or SMS the user has to fill in : Name receiver + Email receiver/ SMS receiver ( with print nothing has to be filled in ) - When the selection at nr. 3 is Email or SMS the user has to fill in a date and time field for when the image has to be send. 4) The Email + name of the user has to be filled in At the end a button.( kind of checkout button, after a check on a different page , gets amapproval and after the approval stores the data into the database. That is the idea, hope that someone can point me in the right direction. Steve -- 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] FORM or SQLFORM
Goodevening, Just started with web2py, looked at some of the web2py videos from Massimo ( which i find very good). Still , i need some pointers to start with a specific page / form and hope that someone can help me with this. Not sure if i should use FORM or SQLFORM and also if i should put al the information in one table or one or more reference tables ( what is good practice). Example of the form i would like to build: 1) Button A, Button B, Button C and a field where someone can fill in a INT ( user selects a value trough one of the buttons or fills in the free field -- Show the selection the user made 2) Select a Image from different images -- Show the selected Image -- 3) Select the delivery : Email, SMS or Print - When the selection at nr. 3 is Email or SMS the user has to fill in : Name receiver + Email receiver/ SMS receiver ( with print nothing has to be filled in ) - When the selection at nr. 3 is Email or SMS the user has to fill in a date and time field for when the image has to be send. 4) The Email + name of the user has to be filled in At the end a button.( kind of checkout button, after a check on a different page , gets amapproval and after the approval stores the data into the database. That is the idea, hope that someone can point me in the right direction. Steve -- 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] FORM or SQLFORM
Goodevening, I am a newby with web2py and i am struggeling how to start with a specific Form ( do i use Form or SQLFORM ) What i would like to do is build a page with some different imput fields ( see below) and after selecting i would like to have a confirm button ( which in a later state would link to a payment gateway). 1) Select A or B or C or free input field --some information-- 2) select a specific Image ( from different images) --Peview selected image -- 3) select how you like the delivery of the selected image : email, sms or print directly ( only 1 can be selected) - depending on the selection a user has to fill out 2 fields of information ( name and that selected at number 3 only for email or sms) - depending on the selection user has to select a day-time ( email or sms). When print option is selected then no date - time will be selected After all these fields have been filled out then i would like to use a button that does something (for example: do a payement) after a succesfull payment the data is stored. At the same time i am thinking about how to set up the database, one table or more tables with reference ... still searching what is the best choice Hope that someone can point me in the right direction ( meanwhile i am seachring through the documentation and this usergroup) ... one table and SQLFORM doesn't give me what i want Steve -- 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: how to disable register item from the default upper right-hand side dropdown
please try : settings.actions_disabled = ['register'] best regards, stifan -- 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] Problem streaming videos in OS X
When I upload a video file (in MPEG4 format) to the static area, only the first several seconds will play in the video control appearing on the page. This happens whether I use an auth.wiki() provisioned page, or if I simply embed a video ../video tag on the Welcome index page. I've tried both video files I've created, as well as some simply downloaded from YouTube and uploaded into the static area from the designing admin page. On the wiki generated page, I can put in a URL for an external site and it streams perfectly. However, when I looked at the page source, that link was using an iframe tag rather than a video tag. The same behavior is exhibited whether I use Chrome or Safari (since Firefox has known issues with MPEG4 files), and whether or not I'm using the server only on localhost or within my lan from another machine. This is the only problem I'm having - and it's a rather serious one, since the project I'm working on uses many, many videos. It's a deep-dive self-guided technical presentation that will be used by a large development team. At this point, I've made no mods to any code at all, with the exception of putting the URL into the wiki page (as: http://HOSTNAME/MyTest/static/testFile.mp4 ) or embedding the same filename as the src file in a video tag in the default_index.html page for the Welcome app. I'm running web2py Version 2.5.1-stable+timestamp.2013.06.06.15.39.19 on an iMac with OS X 10.8.4. The installation was simply to unzip the download into the Applications folder. I'm starting it from a shell using the command line python web2py.py so I can see any possible output. I'm using python 2.7.2. Thanks in advance for any help. -- --- 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/groups/opt_out.
Re: [web2py] Re: help with examples
For examples u can learn it from web2py appliances too. Sent from my BlackBerry® powered by Sinyal Kuat INDOSAT -Original Message- From: Anthony abasta...@gmail.com Sender: web2py@googlegroups.com Date: Sat, 8 Jun 2013 10:29:37 To: web2py@googlegroups.com Reply-To: web2py@googlegroups.com Subject: [web2py] Re: help with examples There are a number of resources linked from the website: http://www.web2py.com/init/default/documentation, including http://killer-web-development.com/ and http://www.youtube.com/playlist?list=PL5E2E223FE3777851. If that doesn't do it for you, come back with some specific questions. Anthony On Saturday, June 8, 2013 6:05:27 AM UTC-4, Herman wrote: Hello, I am new to Web2py and right now i am learning basics of it.I am bit confused that how python code is embeded in HTML.The database related programming and all other examples seems confusing to me.Can someone provide me some links or something to get more understanding of these examples. Thanks. -- --- 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/groups/opt_out. -- --- 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/groups/opt_out.
[web2py] Re: Rendering 'raw' HTML for AngularJS with Web2py
*Dirk Krause solution did work for me but not very well, angularjs had some issues. *Now massimo's suggestion worked perfectly. Here is what I did. views/default/index.html* !DOCTYPE html html ng-app head titleBootstrap 101 Template/title meta name=viewport content=width=device-width, initial-scale=1.0 !-- Global CSS and JS Include -- {%include 'web2py_ajax.html'%} script type=text/javascript 'use strict'; /* Controllers */ function PhoneListCtrl($scope) { $scope.phones = [ {name: Nexus S, snippet: Fast just got faster with Nexus S.}, {name: Motorola XOOM™ with Wi-Fi, snippet: The Next, Next Generation tablet.}, {name: MOTOROLA XOOM™, snippet: The Next, Next Generation tablet.} ]; $scope.name = '{%=message%}'; } /script /head body div ng-controller=PhoneListCtrl div class=btn-group button class=btn{{name}}/button button class=btnMiddle/button button class=btnRight/button /div div class=row-fluid div class=span4h1Hello, world!/h1/div div class=span8pNothing here {{'yet' + '!'}}/p p1 + 2 = {{ 1 + 2 }}/p/div /div div class=container-fluid div class=row-fluid div class=span2 !--Sidebar content-- Search: input type=text class=input-block-level placeholder= ng-model=query/ /div div class=span10 !--Body content-- ul class=phones li ng-repeat=phone in phones | filter:query {{phone.name}} p{{phone.snippet}}/p /li /ul /div /div /div /div /body /html *views/web2py_ajax.html {% response.files.insert(3,URL('static','js/jquery.js')) response.files.insert(3,URL('static','js/angular.js')) response.files.insert(3,URL('static','js/bootstrap.min.js')) response.files.append(URL('static','css/bootstrap.min.css')) response.files.insert(3,URL('static','js/web2py.js')) response.include_meta() response.include_files() %} controllers/default.py response.delimiters = ['{%', '%}'] def index(): return dict(message=Hello from MyApp) -- --- 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/groups/opt_out.
Re: [web2py] Re: datetime diff between tables
I've already built it from the scratch (new data, new application) for all your recommendation function above. The data for created on is set by default in function signature in db.py. I can share the full apps, if you want. Any recommendation how to solve this? Thank you very much Sent from my BlackBerry® powered by Sinyal Kuat INDOSAT -Original Message- From: Massimo Di Pierro massimo.dipie...@gmail.com Sender: web2py@googlegroups.com Date: Sun, 31 Mar 2013 18:41:17 To: web2py@googlegroups.com Reply-To: web2py@googlegroups.com Subject: [web2py] Re: datetime diff between tables I do not think there is a problem with the function. I think there is a problem with the data. On Sunday, 31 March 2013 20:38:06 UTC-5, 黄祥 wrote: with tdiff function have same result it's give 0.00 as the result. yes, i've tried the difference both (more than 1 day and in the same day) but all of it return 0 when i set duration is integer, 0:00:00 when i set duration in datetime and 0.00 when i set duration in double. when i try it with 1 table the compute can work with datetime format for both of different time (more than 1 day and in the same day). e.g. db.define_table('activity', Field('subject'), Field('activity_type', 'list:string'), Field('contact', 'reference contact'), Field('description', 'text'), Field('scheduled_start', 'datetime'), Field('due_date', 'datetime'), Field('actual_start', 'datetime'), Field('actual_end', 'datetime'), *Field('duration', compute=lambda r: r['actual_end']-r['actual_start']),* Field('priority', 'list:string'), Field('status', 'list:string'), auth.signature) have another solution for handle this thing? thanks a lot before -- --- 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/groups/opt_out. -- --- 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/groups/opt_out.
Re: [web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table
please fill with whatever name you want Application name: testdict Upload a package: (path where you downloaded from dropbox file : web2py.app.TechDictionary.w2p) click install -- --- 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/groups/opt_out.
Re: [web2py] Re: centralize file view *.html
already, i even tested it : *example code that not work* *views/block_footer.html* {{block footer}} custom_footer {{end}} *views/default/blog.html* *1.* * *{{extend 'layout.html'}} {{include 'block_footer.html'}} i think the server is confused about which block footer that they will use, so the out put is not as expected, when using include (number 1) and using extend (number 2) any hints, or suggestion about this? thank you so much in advance -- --- 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/groups/opt_out.