[web2py] Re: Email not working
Yea I have the user/pw correct, the smtp settings seem pretty straight forward as well so not sure what the root cause is. On Friday, February 12, 2016 at 4:10:20 PM UTC-5, Dave S wrote: > > > > On Friday, February 12, 2016 at 12:17:57 PM UTC-8, Tom Russell wrote: >> >> Yea I am not trying to blame web2py but it just seems I am not having any >> luck getting an email to send. I am using a smtp interface on the other >> side. >> >> I am just at a loss as to what the issue is and how to solve it. >> >> Thanks, >> >> Tom >> > > FWIW, on my AWS Linux instance, I send email with server "localhost" and > user "None" (I'm hoping that only works from local posts), using either > auth's mailer or smtplib directly. From reading this group for a while, > the most common problem seems to be getting user/password right, especially > with GMail and 2-factor authentication. > > /dps > > > >> On Friday, February 12, 2016 at 2:40:43 PM UTC-5, Niphlod wrote: >>> >>> web2py uses smtplib. as long as on the other side there's an >>> smtp-compatible interface, there's no reason to blame web2py :P >>> >>> On Friday, February 12, 2016 at 8:38:38 PM UTC+1, Tom Russell wrote: >>>> >>>> I have since my last time trying to get email sending working with the >>>> built in registration process moved to Amazon AWS SES mail services which >>>> I >>>> know works well with other people. I have put in all the required info in >>>> db.py needed but still cannot send an email. I have tried gmail, a few >>>> other services and nothing so far seems to work. >>>> >>>> Has anyone tried an actual mail service that works, preferably free or >>>> close to it. I am beginning to think that web2py has an issue doing this >>>> task. >>>> >>>> I really need to get past this hurtle for a product launch soon. >>>> >>>> Thanks, >>>> >>>> Tom >>>> >>> -- 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: Email not working
Yea I am not trying to blame web2py but it just seems I am not having any luck getting an email to send. I am using a smtp interface on the other side. I am just at a loss as to what the issue is and how to solve it. Thanks, Tom On Friday, February 12, 2016 at 2:40:43 PM UTC-5, Niphlod wrote: > > web2py uses smtplib. as long as on the other side there's an > smtp-compatible interface, there's no reason to blame web2py :P > > On Friday, February 12, 2016 at 8:38:38 PM UTC+1, Tom Russell wrote: >> >> I have since my last time trying to get email sending working with the >> built in registration process moved to Amazon AWS SES mail services which I >> know works well with other people. I have put in all the required info in >> db.py needed but still cannot send an email. I have tried gmail, a few >> other services and nothing so far seems to work. >> >> Has anyone tried an actual mail service that works, preferably free or >> close to it. I am beginning to think that web2py has an issue doing this >> task. >> >> I really need to get past this hurtle for a product launch soon. >> >> Thanks, >> >> Tom >> > -- 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] Email not working
I have since my last time trying to get email sending working with the built in registration process moved to Amazon AWS SES mail services which I know works well with other people. I have put in all the required info in db.py needed but still cannot send an email. I have tried gmail, a few other services and nothing so far seems to work. Has anyone tried an actual mail service that works, preferably free or close to it. I am beginning to think that web2py has an issue doing this task. I really need to get past this hurtle for a product launch soon. Thanks, Tom -- 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] Email Registration
I will try that but I also tried doing this locally and not on Pythonanywhere and get the same result so not too sure it is Pythonanywhere. On Monday, January 11, 2016 at 4:35:50 PM UTC-5, Alessio Varalta wrote: > > write in the pythonanywhere forum because for example on my server there > are a service that web2py use automatic for the email we use our > server...but i use also pythonanywhere and i know that have specific > services for example for generate pdf ecc..( i don't use pythonanywhere > with email) So wirte in pythonanywhere forum and ask what type of service > use the site and the problem > > Il giorno sabato 9 gennaio 2016 22:52:17 UTC+1, Tom Russell ha scritto: >> >> Yea I have a premium account with pythonanywhere. >> >> On Saturday, January 9, 2016, Alessio Varalta wrote: >> >>> Maybe is a problem of the server not web2py for example with >>> pythonanywhere you have to have a premium account or on the server there >>> aren't a service for the email >>> >>> Il giorno sabato 9 gennaio 2016 21:41:31 UTC+1, Tom Russell ha scritto: >>>> >>>> >>>> Hi, >>>> >>>> I have everything in place according to the docs to do the email >>>> registration process. However every time I try it in the error log it just >>>> says email not sent and then a print out of what the email would have >>>> looked like had it been sent. I have no idea why I cannot get this to work. >>>> >>>> I am using web2py version 2.12.3-stable+timestamp.2015.08.19.00.18.03 >>>> on pythonanywhere. >>>> >>>> The server where the email from comes from is godaddy. >>>> >>>> Any ideas what to check for with this? >>>> >>>> Thanks, >>>> >>>> Tom >>>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/web2py/7X8GFnVHRU8/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> web2py+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Email Registration
Yea I have a premium account with pythonanywhere. On Saturday, January 9, 2016, Alessio Varalta wrote: > Maybe is a problem of the server not web2py for example with > pythonanywhere you have to have a premium account or on the server there > aren't a service for the email > > Il giorno sabato 9 gennaio 2016 21:41:31 UTC+1, Tom Russell ha scritto: >> >> >> Hi, >> >> I have everything in place according to the docs to do the email >> registration process. However every time I try it in the error log it just >> says email not sent and then a print out of what the email would have >> looked like had it been sent. I have no idea why I cannot get this to work. >> >> I am using web2py version 2.12.3-stable+timestamp.2015.08.19.00.18.03 on >> pythonanywhere. >> >> The server where the email from comes from is godaddy. >> >> Any ideas what to check for with this? >> >> Thanks, >> >> Tom >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/7X8GFnVHRU8/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Email Registration
Hi, I have everything in place according to the docs to do the email registration process. However every time I try it in the error log it just says email not sent and then a print out of what the email would have looked like had it been sent. I have no idea why I cannot get this to work. I am using web2py version 2.12.3-stable+timestamp.2015.08.19.00.18.03 on pythonanywhere. The server where the email from comes from is godaddy. Any ideas what to check for with this? Thanks, Tom -- 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: DAL Select
Thanks. I did originally did iterate through the rows but like this approach better since I know only one row will always match. On Monday, August 18, 2014 11:16:25 AM UTC-4, Anthony wrote: > > .select() returns a Rows object, even if it contains just a single row. > Instead, it should be: > > row = db(db.voltrin.startdate == mydate).select()[0] > > or better: > > row = db(db.voltrin.startdate == mydate).select().first() > > .first() returns None in case no records are returned, which would cause > an error when using a subscript. > > Anthony > > On Monday, August 18, 2014 11:09:37 AM UTC-4, Tom Russell wrote: >> >> I have some simple code that is suppose to grab data from a row in my db >> table. >> >> I do it like: >> >> row = db(db.voltrin.startdate == mydate).select() >> vwtrin = row.vw_trin >> >> I have run this and verified mydate and whatever other variables I have >> are something other than null but I cannot seem to get the data for the >> field in my code above. I can see in the pycharm debugger that the row has >> the colnames listed but I do not see any records or values. >> >> Am I doing this right? >> >> Thanks, >> >> Tom >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] DAL Select
I have some simple code that is suppose to grab data from a row in my db table. I do it like: row = db(db.voltrin.startdate == mydate).select() vwtrin = row.vw_trin I have run this and verified mydate and whatever other variables I have are something other than null but I cannot seem to get the data for the field in my code above. Am I doing this right? Thanks, Tom -- 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] PythonAnywhere Web2py Script
I am trying to run a script that I have in my app. While the log files seem to show my script ran, it does not update the db I have for my app. On the schedule tab in pythonanywhere I have this set up so not sure if it is correct: python2.7 /home/tsrdatatech/web2py/web2py.py -S ttheorydataextractor -M -R / home/tsrdatatech/web2py/applications/ttheorydataextractor/modules/ voltrin_grabber.py And a sample output of what the log says when it runs is below: 2014-07-14 23:00:44 -- Completed task, took 17.00 seconds, return code was 0. web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2014 Version 2.9.5-stable+timestamp.2014.03.16.02.35.39 Database drivers available: SQLite(sqlite3), MySQL(pymysql), MySQL(MySQLdb), MySQL(mysqlconnector), PostgreSQL(psycopg2), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), MongoDB(pymongo), IMAP(imaplib) 2014-07-15 23:00:30 -- Completed task, took 11.00 seconds, return code was 0. It seems like it opens web2py but doesnt really run the script I have I think. 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] layout
I want to use a few parts from a layout for web2py here http://www.web2py.com/layouts/static/plugin_layouts/layouts/CorporateOffice/index.html Mainly I just want the for my layout.html. I tried adding this but it does not seem to work. Is there an easy way to do this? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Scheduler
Well that will work as I already have some stuff running in their schedule tab anyways. On Wednesday, June 4, 2014 9:24:22 PM UTC-4, Michael Beller wrote: > > You can't use the web2py scheduler but you can create your own simple > version. > > Here is more information from the python anywhere forum: > > https://www.pythonanywhere.com/forums/topic/179/ > > Basically you can launch web2py periodically, e.g., once an hour or once > per day, and execute a module that can perform anything you want. You > could also process the tasks in the task table and their associated actions. > > On Wednesday, June 4, 2014 11:00:06 AM UTC-4, Tom Russell wrote: >> >> I have implemented the scheduler per the info and examples in Chapter 4 >> of the book. I am trying to start the workers but my problem is I am not >> sure how to since my app is hosted on pythonanywhere and according to the >> book I need to do it from the interface from where you set the ip and port. >> >> Is there another way to do this? >> >> 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] Scheduler
I have implemented the scheduler per the info and examples in Chapter 4 of the book. I am trying to start the workers but my problem is I am not sure how to since my app is hosted on pythonanywhere and according to the book I need to do it from the interface from where you set the ip and port. Is there another way to do this? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: ValueError: invalid literal for int() with base 10:
awesome, worked. On Thursday, May 29, 2014 3:41:12 PM UTC-4, Niphlod wrote: > > drop the table and recreate it. It's a known issue with sqlite. > > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#SQLite > > On Thursday, May 29, 2014 9:34:28 PM UTC+2, Tom Russell wrote: >> >> I am getting the following error when inserting a new record for a table >> I have. I cannot seem to pinpoint what the cause is at this time. >> >> The error is: >> >> Traceback (most recent call last): >> File >> "/home/tsrdatatech/web2py/applications/ttheorydataextractor/controllers/appadmin.py", >> line 270, in select >> *fields, limitby=(start, stop)) >> File "/home/tsrdatatech/web2py/gluon/dal.py", line 10525, in select >> return adapter.select(self.query,fields,attributes) >> File "/home/tsrdatatech/web2py/gluon/dal.py", line 2458, in select >> return super(SQLiteAdapter, self).select(query, fields, attributes) >> File "/home/tsrdatatech/web2py/gluon/dal.py", line 1882, in select >> return self._select_aux(sql,fields,attributes) >> File "/home/tsrdatatech/web2py/gluon/dal.py", line 1847, in _select_aux >> self.execute(sql) >> File "/home/tsrdatatech/web2py/gluon/dal.py", line 1969, in execute >> return self.log_execute(*a, **b) >> File "/home/tsrdatatech/web2py/gluon/dal.py", line 1963, in log_execute >> ret = self.cursor.execute(command, *a[1:], **b) >> File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 63, in convert_date >> return datetime.date(*map(int, val.split("-"))) >> ValueError: invalid literal for int() with base 10: '12/02/2013' >> >> >> And my table looks like: >> >> db.define_table("daily_data", >> Field("startdate","date",requires=IS_DATE(), label="Date", >> readable=True, writable=False), >> Field("vol_total","double", label="Vol Total", readable=True, >> writable=False), >> Field("wsj_date","string", label="WSJ Date", readable=True, >> writable=False), >> Field("trin","double", label="TRIN", readable=True, writable=False), >> Field("gold","double", readable=True, writable=False), >> Field("vix","double", label="VIX", readable=False, writable=False), >> Field("advances","double", readable=True, writable=False), >> Field("declines","double", readable=True, writable=False), >> Field("adv_vol","double", readable=True, writable=False), >> Field("dec_vol","double", readable=True, writable=False), >> Field("sp_hi","double", readable=True, writable=False), >> Field("sp_low","double", readable=True, writable=False), >> Field("sp_close","double", readable=True, writable=False), >> Field("spy","double", label="SPY", readable=False, writable=False), >> Field("csj","double", label="CSJ", readable=False, writable=False), >> Field("bnd","double", label="BND", readable=False, writable=False), >> Field("cwb","double", label="CWB", readable=False, writable=False), >> Field("bond","double", label="BOND", readable=False, writable=False), >> Field("hys","double", label="HYS", readable=False, writable=False), >> Field("flot","double", label="FLOT", readable=False, writable=False), >> Field("hyg","double", label="HYG", readable=False, writable=False), >> Field("bkln","double", label="BKLN", readable=False, writable=False), >> Field("emb","double", label="EMB", readable=False, writable=False), >> Field("efa","double", label="EFA", readable=False, writable=False), >> Field("fex","double", label="FEX", readable=False, writable=False), >> Field("mdy","double", label="MDY", readable=False, writable=False), >> Field("fnx","double", label="FNX", readable=False, writable=False), >> Field("vti","dou
[web2py] ValueError: invalid literal for int() with base 10:
I am getting the following error when inserting a new record for a table I have. I cannot seem to pinpoint what the cause is at this time. The error is: Traceback (most recent call last): File "/home/tsrdatatech/web2py/applications/ttheorydataextractor/controllers/appadmin.py", line 270, in select *fields, limitby=(start, stop)) File "/home/tsrdatatech/web2py/gluon/dal.py", line 10525, in select return adapter.select(self.query,fields,attributes) File "/home/tsrdatatech/web2py/gluon/dal.py", line 2458, in select return super(SQLiteAdapter, self).select(query, fields, attributes) File "/home/tsrdatatech/web2py/gluon/dal.py", line 1882, in select return self._select_aux(sql,fields,attributes) File "/home/tsrdatatech/web2py/gluon/dal.py", line 1847, in _select_aux self.execute(sql) File "/home/tsrdatatech/web2py/gluon/dal.py", line 1969, in execute return self.log_execute(*a, **b) File "/home/tsrdatatech/web2py/gluon/dal.py", line 1963, in log_execute ret = self.cursor.execute(command, *a[1:], **b) File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 63, in convert_date return datetime.date(*map(int, val.split("-"))) ValueError: invalid literal for int() with base 10: '12/02/2013' And my table looks like: db.define_table("daily_data", Field("startdate","date",requires=IS_DATE(), label="Date", readable=True, writable=False), Field("vol_total","double", label="Vol Total", readable=True, writable=False), Field("wsj_date","string", label="WSJ Date", readable=True, writable=False), Field("trin","double", label="TRIN", readable=True, writable=False), Field("gold","double", readable=True, writable=False), Field("vix","double", label="VIX", readable=False, writable=False), Field("advances","double", readable=True, writable=False), Field("declines","double", readable=True, writable=False), Field("adv_vol","double", readable=True, writable=False), Field("dec_vol","double", readable=True, writable=False), Field("sp_hi","double", readable=True, writable=False), Field("sp_low","double", readable=True, writable=False), Field("sp_close","double", readable=True, writable=False), Field("spy","double", label="SPY", readable=False, writable=False), Field("csj","double", label="CSJ", readable=False, writable=False), Field("bnd","double", label="BND", readable=False, writable=False), Field("cwb","double", label="CWB", readable=False, writable=False), Field("bond","double", label="BOND", readable=False, writable=False), Field("hys","double", label="HYS", readable=False, writable=False), Field("flot","double", label="FLOT", readable=False, writable=False), Field("hyg","double", label="HYG", readable=False, writable=False), Field("bkln","double", label="BKLN", readable=False, writable=False), Field("emb","double", label="EMB", readable=False, writable=False), Field("efa","double", label="EFA", readable=False, writable=False), Field("fex","double", label="FEX", readable=False, writable=False), Field("mdy","double", label="MDY", readable=False, writable=False), Field("fnx","double", label="FNX", readable=False, writable=False), Field("vti","double", label="VTI", readable=False, writable=False), Field("iwd","double", label="IWD", readable=False, writable=False), Field("fta","double", label="FTA", readable=False, writable=False), Field("iwm","double", label="IWM", readable=False, writable=False), Field("dvy","double", label="DVY", readable=False, writable=False), Field("iyr","double", label="IYR", readable=False, writable=False), Field("ijr","double", label="IJR", readable=False, writable=False), Field("tlt","double", label="TLT", readable=False, writable=False), Field("ief","double", label="IEF", readable=False, writable=False), Field("vustx","double", label="VUSTX", readable=False, writable=False), Field("fagix","double", label="FAGIX", readable=False, writable=False), Field("qqq","double", label="QQQ", readable=False, writable=False), ) I know the error refers to a date and actually I had wsj_date as a date field but changed it to a string since I really did not need the date requirement for it. Any suggestions? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: DAL/Decorator for specific data
Works perfect, thanks Anthony. On Wednesday, May 28, 2014 11:10:37 AM UTC-4, Anthony wrote: > > You can include logic to set the readable and writable attributes of > particular fields to True/False depending on Auth group membership. For > example: > > db.define_table('mytable', Field('myfield', readable=False, writable=False > )) > > if auth.has_membership('admin'): > db.mytable.myfield.readable = db.mytable.myfield.writable = True > > I suppose you could write a decorator that does that, but it's not clear > there would be any benefit over the simple approach above. > > Anthony > > On Wednesday, May 28, 2014 11:00:13 AM UTC-4, Tom Russell wrote: >> >> I have read through the docs but have not come across what I am trying to >> do, if its possible. >> >> I have a table with 40 columns of data, I want to use a decorator or >> similar to only allow some of them viewable while others in a different >> membership group can see all of the columns. >> >> Is this something that can be done? >> >> Thanks, >> >> Tom >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] DAL/Decorator for specific data
I have read through the docs but have not come across what I am trying to do, if its possible. I have a table with 40 columns of data, I want to use a decorator or similar to only allow some of them viewable while others in a different membership group can see all of the columns. Is this something that can be done? Thanks, Tom -- 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: Redirect to grid page
Works great Jim, Thank you very much. On Tuesday, May 27, 2014 12:52:33 PM UTC-4, Jim S wrote: > > I would try something like this: > > rows_per_page = 20 # this should be set to whatever the 'paginate' > parm is set to on your call to SQLFORM.grid - default is 20 > page_number = int(query).count() / rows_per_page ) + 1# 'query' > should be the same query that you pass to SQLFORM.grid > > redirect(URL('voltrin_data',vars={'page':page_number),user_signature=True) > > NOT TESTED!! > > Let me know if this doesn't work and I'll code up a test of my own to see > what happens. > > Anyone have a more efficient way of doing this? > > -Jim > > > > On Tuesday, May 27, 2014 11:32:28 AM UTC-5, Tom Russell wrote: >> >> Jim, >> >> Yes I have a grid page in place which is where I go now. The grid though >> has a lot of records and I just want to go to that last record in that >> grid. Since its pagination thats what I am looking for, is how to go to the >> last page in the grid. >> >> On Tuesday, May 27, 2014 12:17:02 PM UTC-4, Jim S wrote: >>> >>> When you say that you want to go to the 'grid' page, do you mean a page >>> with a SQLFORM.grid on it and you want to go into 'edit' mode on a specific >>> record on the grid? >>> >>> -Jim >>> >>> >>> On Tuesday, May 27, 2014 10:42:31 AM UTC-5, Tom Russell wrote: >>>> >>>> I have a simple form where I have a submit button that runs some code. >>>> After the code runs and the data is inserted into my table I do a simple >>>> redirect like so: >>>> >>>> redirect(URL('voltrin_data')) >>>> >>>> That just goes to a page I have set up with a grid. I notice if I am >>>> editing a record and press submit the next page that gets redirected to is >>>> the last record in the grid. >>>> >>>> What I want to do is redirect to my grid but go to the page with the >>>> l;ast entry and not the first page. >>>> >>>> How would I do that? I looked in the book but could not see how I would >>>> do this. >>>> >>>> Thanks, >>>> >>>> Tom >>>> >>> -- 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: Redirect to grid page
Jim, Yes I have a grid page in place which is where I go now. The grid though has a lot of records and I just want to go to that last record in that grid. Since its pagination thats what I am looking for, is how to go to the last page in the grid. On Tuesday, May 27, 2014 12:17:02 PM UTC-4, Jim S wrote: > > When you say that you want to go to the 'grid' page, do you mean a page > with a SQLFORM.grid on it and you want to go into 'edit' mode on a specific > record on the grid? > > -Jim > > > On Tuesday, May 27, 2014 10:42:31 AM UTC-5, Tom Russell wrote: >> >> I have a simple form where I have a submit button that runs some code. >> After the code runs and the data is inserted into my table I do a simple >> redirect like so: >> >> redirect(URL('voltrin_data')) >> >> That just goes to a page I have set up with a grid. I notice if I am >> editing a record and press submit the next page that gets redirected to is >> the last record in the grid. >> >> What I want to do is redirect to my grid but go to the page with the >> l;ast entry and not the first page. >> >> How would I do that? I looked in the book but could not see how I would >> do this. >> >> Thanks, >> >> Tom >> > -- 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] Redirect to grid page
I have a simple form where I have a submit button that runs some code. After the code runs and the data is inserted into my table I do a simple redirect like so: redirect(URL('voltrin_data')) That just goes to a page I have set up with a grid. I notice if I am editing a record and press submit the next page that gets redirected to is the last record in the grid. What I want to do is redirect to my grid but go to the page with the l;ast entry and not the first page. How would I do that? I looked in the book but could not see how I would do this. Thanks, Tom -- 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] Accessing records
Woks perfect, thank you. On Tuesday, May 20, 2014 11:17:12 AM UTC-4, Anthony wrote: > > It is a Rows objects, so yes, you can iterate over it. > > Anthony > > On Tuesday, May 20, 2014 11:06:34 AM UTC-4, Tom Russell wrote: >> >> Thanks. >> >> What would last_five_records be, a list or something I could iterate over? >> >> Tom >> >> On Tuesday, May 20, 2014 10:16:54 AM UTC-4, Johann Spies wrote: >>> >>> >>> >>> >>> On 20 May 2014 16:11, Tom Russell wrote: >>> >>>> I have a table which I insert data from the internet, just 4 records. >>>> Before inserting though I need to get the last 5 rows of data from these 4 >>>> fields and do a calculation with them. Then when I insert the data I add >>>> one more field making it a total of 5 fields I am inserting into the db. >>>> These 5 fields exist already so nothing odd there. >>>> >>>> My main issue is just getting the last 5 records from the db. Is there >>>> a better way to get that data with the DAL? It kind of appears to me that >>>> I >>>> could possibly use limitby to get these as well? >>>> >>>> >>> >>> last_five_records = db(db.sometable.id > >>> 0).select(db.sometable.the_fields_you_want_to_work_with, orderby=~ >>> db.sometable.id, limitby = (0,4)) >>> >>> Regards >>> Johann >>> >>> -- >>> Because experiencing your loyal love is better than life itself, >>> my lips will praise you. (Psalm 63:3) >>> >> -- 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] Accessing records
Thanks. What would last_five_records be, a list or something I could iterate over? Tom On Tuesday, May 20, 2014 10:16:54 AM UTC-4, Johann Spies wrote: > > > > > On 20 May 2014 16:11, Tom Russell >wrote: > >> I have a table which I insert data from the internet, just 4 records. >> Before inserting though I need to get the last 5 rows of data from these 4 >> fields and do a calculation with them. Then when I insert the data I add >> one more field making it a total of 5 fields I am inserting into the db. >> These 5 fields exist already so nothing odd there. >> >> My main issue is just getting the last 5 records from the db. Is there a >> better way to get that data with the DAL? It kind of appears to me that I >> could possibly use limitby to get these as well? >> >> > > last_five_records = db(db.sometable.id > > 0).select(db.sometable.the_fields_you_want_to_work_with, orderby=~ > db.sometable.id, limitby = (0,4)) > > Regards > Johann > > -- > Because experiencing your loyal love is better than life itself, > my lips will praise you. (Psalm 63:3) > -- 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] Accessing records
Anthony, Thanks for the tips. I have a table which I insert data from the internet, just 4 records. Before inserting though I need to get the last 5 rows of data from these 4 fields and do a calculation with them. Then when I insert the data I add one more field making it a total of 5 fields I am inserting into the db. These 5 fields exist already so nothing odd there. My main issue is just getting the last 5 records from the db. Is there a better way to get that data with the DAL? It kind of appears to me that I could possibly use limitby to get these as well? Thanks, Tom On Tuesday, May 20, 2014 9:48:23 AM UTC-4, Anthony wrote: > > Note, there is no guarantee that the records in the db at any given time > have sequential values in the ID field (e.g., when you delete a record, the > value of its ID is then absent from the sequence of IDs). > > Can you explain in more detail what you are actually trying to do? > > Anthony > > On Tuesday, May 20, 2014 9:32:27 AM UTC-4, Tom Russell wrote: >> >> Thanks for the comments. I read Chapter 6 which is where I got the bit of >> code to access the records. Specifically the fetching a row section. >> >> I can ensure that there is records with those id's. Its a script that >> grabs data off from the internet and inserts that data into that table. >> Then I grab the last 5 records including the one it is grabbing to do a >> calculation on it. >> >> It is not too clear in the book how I should be getting a record by the >> id is what I think my problem is. >> >> Thanks, >> >> Tom >> >> On Tuesday, May 20, 2014 4:53:13 AM UTC-4, Johann Spies wrote: >>> >>> On 19 May 2014 22:06, Tom Russell wrote: >>> >>> I have some records in my db that I need to access to get them and >>>> perform some calculations on. >>>> >>>> My code to access the records is: >>>> >>>> rows = db(db.voltrin.id > 0).count() >>>> >>> >>> Let us assume rows = 100 at this point. >>> >>>> >>>> currentrow = rows - 4 >>>> >>> >>> currentrow = 96 >>> >>> >>>> >>>> for x in range(currentrow, rows): >>>> >>>range(96, 100) >>> >>>> record = db.voltrin(db.voltrin.id==x) >>>> >>> record = db.voltrin(db.voltrin.id = >>> 96).select(whateverfieldsyouwantoworkwith) >>> >>> >>> >>>> Is this the right way to access the record at a given id? >>>> >>>> No. >>> >>> I would suggest you read Chapter 6 in the web2py book ( >>> http://web2py.com/book). >>> >>> Just a comment about your code: there is no way you can ensure in the >>> above example that there will be an id==96 in that database. >>> >>> Regards >>> Johann >>> -- >>> Because experiencing your loyal love is better than life itself, >>> my lips will praise you. (Psalm 63:3) >>> >> -- 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] Accessing records
Thanks for the comments. I read Chapter 6 which is where I got the bit of code to access the records. I can ensure that there is records with those id's. Its a script that grabs data off from the internet and inserts that data into that table. Then I grab the last 5 records including the one it is grabbing to do a calculation on it. It is not too clear in the book how I should be getting a record by the id is what I think my problem is. Thanks, Tom On Tuesday, May 20, 2014 4:53:13 AM UTC-4, Johann Spies wrote: > > On 19 May 2014 22:06, Tom Russell >wrote: > > I have some records in my db that I need to access to get them and perform >> some calculations on. >> >> My code to access the records is: >> >> rows = db(db.voltrin.id > 0).count() >> > > Let us assume rows = 100 at this point. > >> >> currentrow = rows - 4 >> > > currentrow = 96 > > >> >> for x in range(currentrow, rows): >> >range(96, 100) > >> record = db.voltrin(db.voltrin.id==x) >> > record = db.voltrin(db.voltrin.id = > 96).select(whateverfieldsyouwantoworkwith) > > > >> Is this the right way to access the record at a given id? >> >> No. > > I would suggest you read Chapter 6 in the web2py book ( > http://web2py.com/book). > > Just a comment about your code: there is no way you can ensure in the > above example that there will be an id==96 in that database. > > Regards > Johann > -- > Because experiencing your loyal love is better than life itself, > my lips will praise you. (Psalm 63:3) > -- 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] Accessing records
Hi, I have some records in my db that I need to access to get them and perform some calculations on. My code to access the records is: rows = db(db.voltrin.id > 0).count() currentrow = rows - 4 for x in range(currentrow, rows): record = db.voltrin(db.voltrin.id==x) adv_list.append(float(record.adv_issues)) dec_list.append(float(record.dec_issues)) adv_vlist.append(float(record.adv_vol)) dec_vlist.append(float(record.dec_vol)) Is this the right way to access the record at a given id? The data I seem to get with any of my lists does not match any of the data in the tables which is why I am unsure of the proper way to access the data for a record. Thanks, Tom -- 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 Action
I have a form that is not connected to a db table. Its a simple form: def getdata_form(): form=FORM('Start Date:', INPUT(_id='startdate', _name='date', _class='date'), 'End Date:', INPUT(_id='enddate', _name='date', _class='date'),INPUT(_type='submit'), _action=URL('grabvoltrindata')) return dict(form=form) Then I have a function that runs some code called def grabvoltrindata() I need to pass in the startdate and enddate, how would I do that? Thanks, Tom -- 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] AppAdmin Link
I have in my default.py this code for a button to call appadmin: {{=A(T("App Admin"), _href=URL('appadmin', scheme='https'), _class='btn', _style='margin-top: 1em;')}} But when I click on the button it defaults to /default/appadmin instead of just appadmin. How do I set this properly? Also, is there a decorator to hide this button if a user is not in a certain group? Thanks, Tom -- 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] SQLite Data
I used csvstudio to process data to the existing sqlite db in web2py. It all went very well and now the data is there. The dates however for a date column only show up with the word None. Is there something else I am missing for the date not to be showing correctly or at all? Thanks, Tom -- 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] updating multiple tables - how to have all updates in the same transaction?
I could be wrong and am still new here but maybe SQLFORM.Factory? Thats what I use on a form that has 2 tables. On Fri, Jun 28, 2013 at 1:41 PM, Cliff Kachinske wrote: > I have two tables something like this: > > db.define_table('item', > Field('name'), > Field('on_hand', integer), > ) > > db.define_table('item_batch', > Field('item', 'reference db.item' ...), > Field('batch_yield', integer), > ) > > Every time I insert a item_batch record, I increment the on_hand field of > the item table by the quantity in tatch_yield. Easy to do using SQLFORM. > > But if I have to update the batch_yield I want to update the item.on_hand > field as well. I also use an onvalidation function to make sanity checks > on the updated batch_yield entry, such as verifying that the new value does > not make item.on_hand a negative number. > > Using SQLFORM, when is the best time to update the item.on_hand field? > > I want to make sure all of the updates are in the same transaction, so > that if one fails, they all get rolled back. How can I do this? > > Thanks, > Cliff Kachinske > > -- > > --- > 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: confused about db.py settings
Nice, I will check that out. On Fri, Jun 28, 2013 at 1:37 PM, Anthony wrote: > Yea thanks I tried that as well with no luck. > > > Then you're doing something else wrong. It might help if you show all of > the code. If you have a model file that does: > > db = DAL(...) > ... > auth = Auth(db) > auth.define_tables() > > The db.auth_user will be available in any subsequent model as well as any > controller and view. If that's not the case, you have an error somewhere > else. > > >> For new users there should be a guide to setting all of this up correctly. > > > It's not clear what information is needed here. If you have done the > above, it should work. > > Also, note if you need an easy way to manage Auth, in trunk there is some > new functionality for this: > https://groups.google.com/d/msg/web2py/HdvSyZCJad4/5y1xQw3D2RgJ. Unlike > the slice you are using, it doesn't put the user record and a grid of > memberships in a modal together, but for each user record, it does provide > a link that lets you directly manage that user's memberships (using > smartgrid). > > Anthony > > -- > > --- > 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: confused about db.py settings
Well whatever the case was it did give me some errors, cant remember which now but I tried a few things to no avail. I know its always this way starting out, been around the block a few times already :) On Fri, Jun 28, 2013 at 1:34 PM, LightDot wrote: > On Friday, June 28, 2013 6:59:19 PM UTC+2, Tom Russell wrote: >> >> Yea thanks I tried that as well with no luck. >> > > That's impossible. But never mind, hang in there, after you finish your > first project, you'll be remembering this beginnings with a smile. > > >> I ended up just creating a new db_wizard.py in my model and this set up >> works great now. Its mentioned in the book but thats it, just mentioned. >> For new users there should be a guide to setting all of this up correctly. >> Maybe there is? I could write something up when I am done sorting it all >> out. >> >> Thanks >> > > Sure, no problem. > > Regards, > Ales > > >> >> On Fri, Jun 28, 2013 at 12:51 PM, LightDot wrote: >> >>> Well, you have: >>> >>> >>> db = DAL('sqlite://storage.sqlite',**pool_size=1,check_reserved=['** >>> all']) >>> >>> defined, then you initiate auth with: >>> >>> auth.define_tables(username=**True, signature=True) >>> >>> which sets up auth tables etc. in the above database. But then you >>> override the previously set db with: >>> >>> >>> db = DAL('sqlite://webform.sqlite') >>> >>> in which you define your own tables. So basically you have set up auth >>> in one database, then you stop using it and use another database, which has >>> no auth set up. That can't work. >>> >>> Simply define db just once, not twice. Use the definition web2py has >>> suggested for you and change the database name if you want to. >>> >>> Regards, >>> Ales >>> >>> >>> >>> On Friday, June 28, 2013 5:05:50 PM UTC+2, Tom Russell wrote: >>>> >>>> I am confused about how I have my db.py set up for tables etc. >>>> >>>> At the top I have what is generated for me: >>>> >>>> if not request.env.web2py_runtime_**gae**: >>>> ## if NOT running on Google App Engine use SQLite or other DB >>>> db = DAL('sqlite://storage.sqlite', >>>> pool_size=1,check_reserved=['**a**ll']) >>>> else: >>>> ## connect to Google BigTable (optional >>>> 'google:datastore://namespace') >>>> db = DAL('google:datastore') >>>> ## store sessions and tickets there >>>> session.connect(request, response, db=db) >>>> ## or store session in Memcache, Redis, etc. >>>> ## from gluon.contrib.memdb import MEMDB >>>> ## from google.appengine.api.memcache import Client >>>> ## session.connect(request, response, db = MEMDB(Client())) >>>> >>>> from gluon.tools import Auth, Crud, Service, PluginManager, >>>> prettydate, Mail >>>> auth = Auth(db) >>>> crud, service, plugins = Crud(db), Service(), PluginManager() >>>> db._common_fields.append(auth.signature) ## adds signature fields >>>> to all tables >>>> ## create all tables needed by auth if not custom tables >>>> auth.define_tables(username=**Tr**ue, signature=True) >>>> >>>> And then from examples I have for my db down a ways is: >>>> >>>> db = DAL('sqlite://webform.sqlite') >>>> >>>> then I define my tables... >>>> >>>> >>>> Problem with this is though I am trying to use http://www.web2pyslices. >>>> **co**m/slice/show/1542/manage-**users**-and-memebership-in-the-**same- >>>> **form<http://www.web2pyslices.com/slice/show/1542/manage-users-and-memebership-in-the-same-form>because >>>> I need that feature but when trying to use it I get an error cause >>>> auth_user doesnt exist. Well it doesnt because I set db = >>>> DAL('sqlite://webform.sqlite') but in default.py I do have: >>>> >>>> def user(): >>>> """ >>>> exposes: >>>> http:///[app]/default/**user**/login >>>> http:///[app]/default/**user**/logout >>>> http:///[app]/default/**user**/register >>>> http:///[app]/default/**user**/profile >&
[web2py] Passing an arg
I have a smartgrid with a link in it like this: links = [lambda row: A(T('Create Appointment'),_href=URL("default", "appointment_create",args=[row.id]))] And I pass that to this function: @auth.requires_login() def appointment_create(): record = db.patient(request.args(0)) db.appointment.patient.default = record db.appointment.patient.writable = False form = SQLFORM(db.appointment, next='appointment_select') return dict(form=form) And that gives me the whole record but I am looking for just the name of the patient in this case. IN my db I set format='%(first_name)s %(last_name)s') expecting to get that returned on the record but not so. What should I be doing to obtain this correctly? 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.
Re: [web2py] Re: confused about db.py settings
Yea thanks I tried that as well with no luck. I ended up just creating a new db_wizard.py in my model and this set up works great now. Its mentioned in the book but thats it, just mentioned. For new users there should be a guide to setting all of this up correctly. Maybe there is? I could write something up when I am done sorting it all out. Thanks On Fri, Jun 28, 2013 at 12:51 PM, LightDot wrote: > Well, you have: > > > db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) > > defined, then you initiate auth with: > > auth.define_tables(username=True, signature=True) > > which sets up auth tables etc. in the above database. But then you > override the previously set db with: > > > db = DAL('sqlite://webform.sqlite') > > in which you define your own tables. So basically you have set up auth in > one database, then you stop using it and use another database, which has no > auth set up. That can't work. > > Simply define db just once, not twice. Use the definition web2py has > suggested for you and change the database name if you want to. > > Regards, > Ales > > > > On Friday, June 28, 2013 5:05:50 PM UTC+2, Tom Russell wrote: >> >> I am confused about how I have my db.py set up for tables etc. >> >> At the top I have what is generated for me: >> >> if not request.env.web2py_runtime_**gae: >> ## if NOT running on Google App Engine use SQLite or other DB >> db = DAL('sqlite://storage.sqlite',**pool_size=1,check_reserved=['** >> all']) >> else: >> ## connect to Google BigTable (optional 'google:datastore://namespace' >> **) >> db = DAL('google:datastore') >> ## store sessions and tickets there >> session.connect(request, response, db=db) >> ## or store session in Memcache, Redis, etc. >> ## from gluon.contrib.memdb import MEMDB >> ## from google.appengine.api.memcache import Client >> ## session.connect(request, response, db = MEMDB(Client())) >> >> from gluon.tools import Auth, Crud, Service, PluginManager, >> prettydate, Mail >> auth = Auth(db) >> crud, service, plugins = Crud(db), Service(), PluginManager() >> db._common_fields.append(auth.**signature) ## adds signature fields to >> all tables >> ## create all tables needed by auth if not custom tables >> auth.define_tables(username=**True, signature=True) >> >> And then from examples I have for my db down a ways is: >> >> db = DAL('sqlite://webform.sqlite') >> >> then I define my tables... >> >> >> Problem with this is though I am trying to use http://www.web2pyslices.** >> com/slice/show/1542/manage-**users-and-memebership-in-the-**same-form<http://www.web2pyslices.com/slice/show/1542/manage-users-and-memebership-in-the-same-form>because >> I need that feature but when trying to use it I get an error cause >> auth_user doesnt exist. Well it doesnt because I set db = >> DAL('sqlite://webform.sqlite') but in default.py I do have: >> >> def user(): >> """ >> exposes: >> http:///[app]/default/**user/login >> http:///[app]/default/**user/logout >> http:///[app]/default/**user/register >> http:///[app]/default/**user/profile >> http:///[app]/default/**user/retrieve_password >> http:///[app]/default/**user/change_password >> http:///[app]/default/**user/manage_users (requires membership >> in >> use @auth.requires_login() >> @auth.requires_membership('**group name') >> @auth.requires_permission('**read','table name',record_id) >> to decorate functions that need access control >> """ >> return dict(form=auth()) >> >> So bottom line, how do I get around or use auth_user in my app. If I >> comment out my >> db = DAL('sqlite://webform.sqlite') but in default.py, nothing works. >> >> Any help? >> >> 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] confused about db.py settings
I am confused about how I have my db.py set up for tables etc. At the top I have what is generated for me: if not request.env.web2py_runtime_gae: ## if NOT running on Google App Engine use SQLite or other DB db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) else: ## connect to Google BigTable (optional 'google:datastore://namespace') db = DAL('google:datastore') ## store sessions and tickets there session.connect(request, response, db=db) ## or store session in Memcache, Redis, etc. ## from gluon.contrib.memdb import MEMDB ## from google.appengine.api.memcache import Client ## session.connect(request, response, db = MEMDB(Client())) from gluon.tools import Auth, Crud, Service, PluginManager, prettydate, Mail auth = Auth(db) crud, service, plugins = Crud(db), Service(), PluginManager() db._common_fields.append(auth.signature) ## adds signature fields to all tables ## create all tables needed by auth if not custom tables auth.define_tables(username=True, signature=True) And then from examples I have for my db down a ways is: db = DAL('sqlite://webform.sqlite') then I define my tables... Problem with this is though I am trying to use http://www.web2pyslices.com/slice/show/1542/manage-users-and-memebership-in-the-same-formbecause I need that feature but when trying to use it I get an error cause auth_user doesnt exist. Well it doesnt because I set db = DAL('sqlite://webform.sqlite') but in default.py I do have: def user(): """ exposes: http:///[app]/default/user/login http:///[app]/default/user/logout http:///[app]/default/user/register http:///[app]/default/user/profile http:///[app]/default/user/retrieve_password http:///[app]/default/user/change_password http:///[app]/default/user/manage_users (requires membership in use @auth.requires_login() @auth.requires_membership('group name') @auth.requires_permission('read','table name',record_id) to decorate functions that need access control """ return dict(form=auth()) So bottom line, how do I get around or use auth_user in my app. If I comment out my db = DAL('sqlite://webform.sqlite') but in default.py, nothing works. Any help? 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.
Re: [web2py] sqlform.factory widget in field problem
Actually probably just comment out the line: fs3=form[0][-1] # submit row (last) and that I think will put the submit outside the fieldset. On Fri, Jun 28, 2013 at 2:50 AM, António Ramos wrote: > I dont understand how that gets the submit button out of the last fieldset > > > 2013/6/28 Tom Russell > >> Here's the rest of my code doing what I posted before... >> >> if form.process().accepted: >> id = db.patient.insert(**db.patient._filter_fields(form.vars)) >> form.vars.patient=id >> id = >> db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars)) >> id = >> db.dependents.insert(**db.dependents._filter_fields(form.vars)) >> #form.vars.dependents=id >> # and get a list of all persons >> redirect(URL('manage_patients')) >> >> style = STYLE(""".not_empty {color:#d00;}""") >> >> return dict(form=DIV(style,form)) >> >> >> On Thu, Jun 27, 2013 at 5:31 PM, António Ramos wrote: >> >>> Using this suggestion , my submit button is inside the last fieldset. >>> How do i take it outside? >>> >>> >>> 2013/6/26 Tom Russell >>> >>>> To group inside a field I do something like this with 3 different >>>> tables: >>>> >>>> form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents) >>>> fs0=form[0][:26] #patient rows >>>> fs1=form[0][26:37] #emergency contacts >>>> fs2=form[0][37:41] #dependents >>>> fs3=form[0][-1] # submit row (last) >>>> >>>> form[0]=TABLE( >>>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), >>>> FIELDSET(TAG.legend("Emergency Contact >>>> Info"),TABLE(fs1),_id="register1"), >>>> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), >>>> TABLE(fs3)) >>>> >>>> >>>> HTH >>>> >>>> >>>> On Wed, Jun 26, 2013 at 11:58 AM, António Ramos >>>> wrote: >>>> >>>>> Just drafting something but here is the problem >>>>> >>>>> My context: >>>>> I have 3 tables >>>>> >>>>> table form >>>>> table steps >>>>> table fields >>>>> >>>>> A form can have many steps >>>>> a step can have many fields >>>>> >>>>> This way i can have one form with 3 steps, each with some fields and >>>>> another form with 10 steps , each with some more fields. >>>>> >>>>> i read these tables to create a form using factory. >>>>> >>>>> i have 2 problems >>>>> >>>>> >>>>> *1 i need to mark the input fields with a "step" tag * >>>>> >>>>> here is my code: >>>>> >>>>> def my_string_widget(field, value,step): >>>>> >>>>> return INPUT(_name=field.name, >>>>> _id="%s_%s" % (field._tablename, field.name), >>>>> _class=field.type, >>>>> _value='', >>>>> *_step=step,* >>>>> requires=field.requires) >>>>> >>>>> def index(): >>>>> cont=0 >>>>> fields=[] >>>>> formid=db.form(request.args(0) or 1) >>>>> steps=formid.steps.select() >>>>> for step in steps: >>>>> print "step id-",step.id >>>>> for field in step.fields.select(): >>>>> print "field...",field.step >>>>> fields.append(Field(field.nome,widget=lambda >>>>> field,value:my_string_widget(field,value,*step.id*))) >>>>> >>>>> form=SQLFORM.factory(*fields) >>>>> print form >>>>> if form.process().accepted: >>>>> response.flash='a gravar registo' >>>>> return dict(nome=formid.nome,form=form) >>>>> >>>>> >>>>> The problem is: >>>>> It marks all fields with the same "step" value, the last value in * >>>>> step.id, why?* >>>>> * >>>>> * >>>>> *2 - sql
Re: [web2py] sqlform.factory widget in field problem
Here's the rest of my code doing what I posted before... if form.process().accepted: id = db.patient.insert(**db.patient._filter_fields(form.vars)) form.vars.patient=id id = db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars)) id = db.dependents.insert(**db.dependents._filter_fields(form.vars)) #form.vars.dependents=id # and get a list of all persons redirect(URL('manage_patients')) style = STYLE(""".not_empty {color:#d00;}""") return dict(form=DIV(style,form)) On Thu, Jun 27, 2013 at 5:31 PM, António Ramos wrote: > Using this suggestion , my submit button is inside the last fieldset. > How do i take it outside? > > > 2013/6/26 Tom Russell > >> To group inside a field I do something like this with 3 different tables: >> >> form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents) >> fs0=form[0][:26] #patient rows >> fs1=form[0][26:37] #emergency contacts >> fs2=form[0][37:41] #dependents >> fs3=form[0][-1] # submit row (last) >> >> form[0]=TABLE( >> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), >> FIELDSET(TAG.legend("Emergency Contact >> Info"),TABLE(fs1),_id="register1"), >> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), >> TABLE(fs3)) >> >> >> HTH >> >> >> On Wed, Jun 26, 2013 at 11:58 AM, António Ramos wrote: >> >>> Just drafting something but here is the problem >>> >>> My context: >>> I have 3 tables >>> >>> table form >>> table steps >>> table fields >>> >>> A form can have many steps >>> a step can have many fields >>> >>> This way i can have one form with 3 steps, each with some fields and >>> another form with 10 steps , each with some more fields. >>> >>> i read these tables to create a form using factory. >>> >>> i have 2 problems >>> >>> >>> *1 i need to mark the input fields with a "step" tag * >>> >>> here is my code: >>> >>> def my_string_widget(field, value,step): >>> >>> return INPUT(_name=field.name, >>> _id="%s_%s" % (field._tablename, field.name), >>> _class=field.type, >>> _value='', >>> *_step=step,* >>> requires=field.requires) >>> >>> def index(): >>> cont=0 >>> fields=[] >>> formid=db.form(request.args(0) or 1) >>> steps=formid.steps.select() >>> for step in steps: >>> print "step id-",step.id >>> for field in step.fields.select(): >>> print "field...",field.step >>> fields.append(Field(field.nome,widget=lambda >>> field,value:my_string_widget(field,value,*step.id*))) >>> >>> form=SQLFORM.factory(*fields) >>> print form >>> if form.process().accepted: >>> response.flash='a gravar registo' >>> return dict(nome=formid.nome,form=form) >>> >>> >>> The problem is: >>> It marks all fields with the same "step" value, the last value in * >>> step.id, why?* >>> * >>> * >>> *2 - sqlformfactory * >>> how do i group sqlformfactory fields inside a div? >>> i want to create a section for each step in the form to style with css >>> >>> Best regards >>> António >>> >>> -- >>> >>> --- >>> 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. >> >> >> > > -- > > --- > 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: JQuery Issue
I use chrome but I will have to try that. Thanks. On Thu, Jun 27, 2013 at 3:31 PM, Jim S wrote: > Do you use firefox and firebug? > > You can use the javascript console there to display to you any errors that > might be occurring in your javascript. You may have an issue earlier on in > your page (with javascript) that is preventing the execution of your stuff > later on. > > -Jim > > On Thursday, June 27, 2013 10:26:56 AM UTC-5, Tom Russell wrote: > >> So If I do something like: >> >> jAlert('This is a custom alert box', 'Alert Dialog'); >> >> and nothing shows up, could it be that the jquery lib is not being made >> available? >> >> >> On Thu, Jun 27, 2013 at 11:00 AM, Tom Russell wrote: >> >>> k thanks I will try that >>> >>> >>> >>> On Thu, Jun 27, 2013 at 10:58 AM, Jim Steil wrote: >>> >>>> I'd try putting some alert() messages in to try to trace the flow and >>>> check the values of variables. >>>> >>>> >>>> >>>> On Thu, Jun 27, 2013 at 9:53 AM, Tom Russell wrote: >>>> >>>>> Thats weird, now it will not hide the the field but has no effect >>>>> either when you check the checkbox. >>>>> >>>>> >>>>> On Thu, Jun 27, 2013 at 12:11 AM, Jim S wrote: >>>>> >>>>>> Try this, you need brackets for your if statements in javascript. >>>>>> >>>>>> jQuery(document).ready(functio**n(){ >>>>>> jQuery('#no_table_mothers_**name__row').hide(); >>>>>> jQuery('#is_newborn').change(**function(){ >>>>>>if(jQuery('#is_newborn').attr**('checked')) { >>>>>> jQuery('#no_table_mothers_**name__row').show(); >>>>>>} else { >>>>>> jQuery('#no_table_mothers_**name__row').hide(); >>>>>>}); >>>>>> }); >>>>>> }); >>>>>> >>>>>> >>>>>> On Wednesday, June 26, 2013 9:09:00 PM UTC-5, Tom Russell wrote: >>>>>>> >>>>>>> I cannot seem to get some jquery code to work right and not sure >>>>>>> why. Basically when I click a checkbox I want another field to appear >>>>>>> below >>>>>>> that one. >>>>>>> >>>>>>> This is my form code: >>>>>>> >>>>>>> @auth.requires_login() >>>>>>> def register_patient(): >>>>>>> mark_not_empty(db.patient) >>>>>>> mark_not_empty(db.**emergencycontacts) >>>>>>> mark_not_empty(db.dependents) >>>>>>> db.patient.medical_record_**number.default = 'KND' + >>>>>>> str(date.today().year) + '' + str(random.randrange(1, 999+1)) >>>>>>> db.patient.medical_record_**number.writable = False >>>>>>> form=SQLFORM.factory(db.**patient, db.emergencycontacts, >>>>>>> db.dependents) >>>>>>> >>>>>>> fs0=form[0][:27] #patient rows >>>>>>> fs1=form[0][27:38] #emergency contacts >>>>>>> fs2=form[0][38:42] #dependents >>>>>>> fs3=form[0][-1] # submit row (last) >>>>>>> >>>>>>> form[0]=TABLE( >>>>>>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="** >>>>>>> register0"), >>>>>>> FIELDSET(TAG.legend("Emergency Contact Info"),TABLE(fs1),_id="** >>>>>>> register1"), >>>>>>> FIELDSET(TAG.legend("**Dependents"),TABLE(fs2),_id="** >>>>>>> register2"), >>>>>>> TABLE(fs3)) >>>>>>> if form.process().accepted: >>>>>>> id = db.patient.insert(**db.**patient._filter_fields(form.** >>>>>>> vars)) >>>>>>> form.vars.patient=id >>>>>>> id = db.emergencycontacts.insert( >>>>>>> db.emergencycontacts._filter_**fields(form.vars)) >>>>>>> id = db.dependents.insert(**db.**dependents._filter_fields(* >>>>>>> *form.vars)) >>>
[web2py] Use model in another app
I have 2 apps and one I want to use the model/db from it in the other in a SQLFORM.grid. I have read through and googled and cannot find a way to do this. Is this possible and how? Thanks, Tom -- --- 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: JQuery Issue
So If I do something like: jAlert('This is a custom alert box', 'Alert Dialog'); and nothing shows up, could it be that the jquery lib is not being made available? On Thu, Jun 27, 2013 at 11:00 AM, Tom Russell wrote: > k thanks I will try that > > > > On Thu, Jun 27, 2013 at 10:58 AM, Jim Steil wrote: > >> I'd try putting some alert() messages in to try to trace the flow and >> check the values of variables. >> >> >> >> On Thu, Jun 27, 2013 at 9:53 AM, Tom Russell wrote: >> >>> Thats weird, now it will not hide the the field but has no effect either >>> when you check the checkbox. >>> >>> >>> On Thu, Jun 27, 2013 at 12:11 AM, Jim S wrote: >>> >>>> Try this, you need brackets for your if statements in javascript. >>>> >>>> jQuery(document).ready(function(){ >>>> jQuery('#no_table_mothers_name__row').hide(); >>>> jQuery('#is_newborn').change(function(){ >>>>if(jQuery('#is_newborn').attr('checked')) { >>>> jQuery('#no_table_mothers_name__row').show(); >>>>} else { >>>> jQuery('#no_table_mothers_name__row').hide(); >>>>}); >>>> }); >>>> }); >>>> >>>> >>>> On Wednesday, June 26, 2013 9:09:00 PM UTC-5, Tom Russell wrote: >>>>> >>>>> I cannot seem to get some jquery code to work right and not sure why. >>>>> Basically when I click a checkbox I want another field to appear below >>>>> that >>>>> one. >>>>> >>>>> This is my form code: >>>>> >>>>> @auth.requires_login() >>>>> def register_patient(): >>>>> mark_not_empty(db.patient) >>>>> mark_not_empty(db.emergencycontacts) >>>>> mark_not_empty(db.dependents) >>>>> db.patient.medical_record_number.default = 'KND' + >>>>> str(date.today().year) + '' + str(random.randrange(1, 999+1)) >>>>> db.patient.medical_record_number.writable = False >>>>> form=SQLFORM.factory(db.patient, db.emergencycontacts, >>>>> db.dependents) >>>>> >>>>> fs0=form[0][:27] #patient rows >>>>> fs1=form[0][27:38] #emergency contacts >>>>> fs2=form[0][38:42] #dependents >>>>> fs3=form[0][-1] # submit row (last) >>>>> >>>>> form[0]=TABLE( >>>>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), >>>>> FIELDSET(TAG.legend("Emergency Contact >>>>> Info"),TABLE(fs1),_id="register1"), >>>>> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), >>>>> TABLE(fs3)) >>>>> if form.process().accepted: >>>>> id = db.patient.insert(**db.patient._filter_fields(form.vars)) >>>>> form.vars.patient=id >>>>> id = >>>>> db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars)) >>>>> id = >>>>> db.dependents.insert(**db.dependents._filter_fields(form.vars)) >>>>> #form.vars.dependents=id >>>>> # and get a list of all persons >>>>> redirect(URL('manage_patients')) >>>>> >>>>> style = STYLE(""".not_empty {color:#d00;}""") >>>>> >>>>> return dict(form=DIV(style,form)) >>>>> >>>>> My html code: >>>>> >>>>> {{left_sidebar_enabled=True}} >>>>> {{extend 'layout.html'}} >>>>> >>>>> {{block left_sidebar}} >>>>> Home >>>>> >>>>> Home(Physician) >>>>> Home(Front Desk) >>>>> Home(Nurse) >>>>> Home(Lab) >>>>> Home(Radiology) >>>>> Home(Pharmacist) >>>>> Home(Cashier) >>>>> >>>>> >>>> href="/patient/default/manage_patients">Patients >>>>> Task Lists >>>>> Appo
Re: [web2py] Re: JQuery Issue
k thanks I will try that On Thu, Jun 27, 2013 at 10:58 AM, Jim Steil wrote: > I'd try putting some alert() messages in to try to trace the flow and > check the values of variables. > > > > On Thu, Jun 27, 2013 at 9:53 AM, Tom Russell wrote: > >> Thats weird, now it will not hide the the field but has no effect either >> when you check the checkbox. >> >> >> On Thu, Jun 27, 2013 at 12:11 AM, Jim S wrote: >> >>> Try this, you need brackets for your if statements in javascript. >>> >>> jQuery(document).ready(function(){ >>> jQuery('#no_table_mothers_name__row').hide(); >>> jQuery('#is_newborn').change(function(){ >>>if(jQuery('#is_newborn').attr('checked')) { >>> jQuery('#no_table_mothers_name__row').show(); >>>} else { >>> jQuery('#no_table_mothers_name__row').hide(); >>>}); >>> }); >>> }); >>> >>> >>> On Wednesday, June 26, 2013 9:09:00 PM UTC-5, Tom Russell wrote: >>>> >>>> I cannot seem to get some jquery code to work right and not sure why. >>>> Basically when I click a checkbox I want another field to appear below that >>>> one. >>>> >>>> This is my form code: >>>> >>>> @auth.requires_login() >>>> def register_patient(): >>>> mark_not_empty(db.patient) >>>> mark_not_empty(db.emergencycontacts) >>>> mark_not_empty(db.dependents) >>>> db.patient.medical_record_number.default = 'KND' + >>>> str(date.today().year) + '' + str(random.randrange(1, 999+1)) >>>> db.patient.medical_record_number.writable = False >>>> form=SQLFORM.factory(db.patient, db.emergencycontacts, >>>> db.dependents) >>>> >>>> fs0=form[0][:27] #patient rows >>>> fs1=form[0][27:38] #emergency contacts >>>> fs2=form[0][38:42] #dependents >>>> fs3=form[0][-1] # submit row (last) >>>> >>>> form[0]=TABLE( >>>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), >>>> FIELDSET(TAG.legend("Emergency Contact >>>> Info"),TABLE(fs1),_id="register1"), >>>> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), >>>> TABLE(fs3)) >>>> if form.process().accepted: >>>> id = db.patient.insert(**db.patient._filter_fields(form.vars)) >>>> form.vars.patient=id >>>> id = >>>> db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars)) >>>> id = >>>> db.dependents.insert(**db.dependents._filter_fields(form.vars)) >>>> #form.vars.dependents=id >>>> # and get a list of all persons >>>> redirect(URL('manage_patients')) >>>> >>>> style = STYLE(""".not_empty {color:#d00;}""") >>>> >>>> return dict(form=DIV(style,form)) >>>> >>>> My html code: >>>> >>>> {{left_sidebar_enabled=True}} >>>> {{extend 'layout.html'}} >>>> >>>> {{block left_sidebar}} >>>> Home >>>> >>>> Home(Physician) >>>> Home(Front Desk) >>>> Home(Nurse) >>>> Home(Lab) >>>> Home(Radiology) >>>> Home(Pharmacist) >>>> Home(Cashier) >>>> >>>> >>> href="/patient/default/manage_patients">Patients >>>> Task Lists >>>> Appointment >>>> Order >>>> Consumables >>>> Prescriptions >>>> Immunization >>>> Laboratory Orders >>>> Radiology Orders >>>> Patient >>>> Accounting >>>> Admin >>>> >>>> {{end}} >>>> >>>> >>>> Register Patient >>>> >>>> {{=form}} >>>> >>>> >>>> jQuery(document).ready(function(){ >>>>jQuery('#no_tab
Re: [web2py] Re: JQuery Issue
Thats weird, now it will not hide the the field but has no effect either when you check the checkbox. On Thu, Jun 27, 2013 at 12:11 AM, Jim S wrote: > Try this, you need brackets for your if statements in javascript. > > jQuery(document).ready(function(){ > jQuery('#no_table_mothers_name__row').hide(); > jQuery('#is_newborn').change(function(){ >if(jQuery('#is_newborn').attr('checked')) { > jQuery('#no_table_mothers_name__row').show(); >} else { > jQuery('#no_table_mothers_name__row').hide(); >}); > }); > }); > > > On Wednesday, June 26, 2013 9:09:00 PM UTC-5, Tom Russell wrote: >> >> I cannot seem to get some jquery code to work right and not sure why. >> Basically when I click a checkbox I want another field to appear below that >> one. >> >> This is my form code: >> >> @auth.requires_login() >> def register_patient(): >> mark_not_empty(db.patient) >> mark_not_empty(db.emergencycontacts) >> mark_not_empty(db.dependents) >> db.patient.medical_record_number.default = 'KND' + >> str(date.today().year) + '' + str(random.randrange(1, 999+1)) >> db.patient.medical_record_number.writable = False >> form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents) >> >> fs0=form[0][:27] #patient rows >> fs1=form[0][27:38] #emergency contacts >> fs2=form[0][38:42] #dependents >> fs3=form[0][-1] # submit row (last) >> >> form[0]=TABLE( >> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), >> FIELDSET(TAG.legend("Emergency Contact >> Info"),TABLE(fs1),_id="register1"), >> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), >> TABLE(fs3)) >> if form.process().accepted: >> id = db.patient.insert(**db.patient._filter_fields(form.vars)) >> form.vars.patient=id >> id = >> db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars)) >> id = >> db.dependents.insert(**db.dependents._filter_fields(form.vars)) >> #form.vars.dependents=id >> # and get a list of all persons >> redirect(URL('manage_patients')) >> >> style = STYLE(""".not_empty {color:#d00;}""") >> >> return dict(form=DIV(style,form)) >> >> My html code: >> >> {{left_sidebar_enabled=True}} >> {{extend 'layout.html'}} >> >> {{block left_sidebar}} >> Home >> >> Home(Physician) >> Home(Front Desk) >> Home(Nurse) >> Home(Lab) >> Home(Radiology) >> Home(Pharmacist) >> Home(Cashier) >> >> > href="/patient/default/manage_patients">Patients >> Task Lists >> Appointment >> Order >> Consumables >> Prescriptions >> Immunization >> Laboratory Orders >> Radiology Orders >> Patient Accounting >> Admin >> >> {{end}} >> >> >> Register Patient >> >> {{=form}} >> >> >> jQuery(document).ready(function(){ >>jQuery('#no_table_mothers_name__row').hide(); >>jQuery('#is_newborn').change(function(){ >> if(jQuery('#is_newborn').attr('checked')) >> jQuery('#no_table_mothers_name__row').show(); >> else jQuery('#no_table_mothers_name__row').hide();}); >> }); >> >> >> >> And this is the info from the page source showing the id's for what >> fields I am working with: >> >> Is Newborn: >> > name="is_newborn" type="checkbox" value="on" /> >> > for="no_table_mothers_name" id="no_table_mothers_name__label">Mothers >> Name: > >> I think I have the right code for the jquery but nothing happens when I >> try this. >> >> Any ideas? >> > -- > > --- > 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] JQuery Issue
I cannot seem to get some jquery code to work right and not sure why. Basically when I click a checkbox I want another field to appear below that one. This is my form code: @auth.requires_login() def register_patient(): mark_not_empty(db.patient) mark_not_empty(db.emergencycontacts) mark_not_empty(db.dependents) db.patient.medical_record_number.default = 'KND' + str(date.today().year) + '' + str(random.randrange(1, 999+1)) db.patient.medical_record_number.writable = False form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents) fs0=form[0][:27] #patient rows fs1=form[0][27:38] #emergency contacts fs2=form[0][38:42] #dependents fs3=form[0][-1] # submit row (last) form[0]=TABLE( FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), FIELDSET(TAG.legend("Emergency Contact Info"),TABLE(fs1),_id="register1"), FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), TABLE(fs3)) if form.process().accepted: id = db.patient.insert(**db.patient._filter_fields(form.vars)) form.vars.patient=id id = db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars)) id = db.dependents.insert(**db.dependents._filter_fields(form.vars)) #form.vars.dependents=id # and get a list of all persons redirect(URL('manage_patients')) style = STYLE(""".not_empty {color:#d00;}""") return dict(form=DIV(style,form)) My html code: {{left_sidebar_enabled=True}} {{extend 'layout.html'}} {{block left_sidebar}} Home Home(Physician) Home(Front Desk) Home(Nurse) Home(Lab) Home(Radiology) Home(Pharmacist) Home(Cashier) Patients Task Lists Appointment Order Consumables Prescriptions Immunization Laboratory Orders Radiology Orders Patient Accounting Admin {{end}} Register Patient {{=form}} jQuery(document).ready(function(){ jQuery('#no_table_mothers_name__row').hide(); jQuery('#is_newborn').change(function(){ if(jQuery('#is_newborn').attr('checked')) jQuery('#no_table_mothers_name__row').show(); else jQuery('#no_table_mothers_name__row').hide();}); }); And this is the info from the page source showing the id's for what fields I am working with: Is Newborn: Mothers Name: https://groups.google.com/groups/opt_out.
Re: [web2py] Appointment Manager
/public/basic</a> >> ', >> // className: 'gcal-event', >> // currentTimezone: 'America/Montreal'}, >> {url: >> '/your_app_name/your_controller/calendar_json_feed', 'color': 'rgb(84, 132, >> 237)', cache: true}, >> // you can insert here all the other json feed you want >> for the stuff you want to display, you can change color to make those >> differents groups of events distinctive >> ], >> // feed by simplejson function >> //[ >> //{ >> //title: "S-20120215-U219-2p", >> //allDay: false, >> //start: "2013-03-22 08:30:00", // Leading zero is >> important for Firefox, comment 2 in answer : >> <a rel="nofollow" href="http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox">http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox</a> >> //end: "2013-03-22 09:30:00", >> //url: '/sgddms/lotns/read/lotns_sample/623' >> //} >> //], >> header: { >> left: 'today prevYear,nextYear prev,next', >> center: 'title', >> right: 'month,basicWeek,basicDay' >> }, >> {{if T.accepted_language.split('-')[0] == 'fr':}} >> timeFormat: 'H(:mm)', // uppercase H for 24-hour clock >> {{pass}} >> monthNames: ["{{=T('January')}}", >> "{{=T('February')}}", >> "{{=T('March')}}", >> "{{=T('April')}}", >> "{{=T('May')}}", >> "{{=T('June')}}", >> "{{=T('July')}}", >> "{{=T('August')}}", >> "{{=T('September')}}", >> "{{=T('October')}}", >> "{{=T('November')}}", >> "{{=T('December')}}"], >> dayNames: ["{{=T('Sunday')}}", >> "{{=T('Monday')}}", >> "{{=T('Tuesday')}}", >> "{{=T('Wednesday')}}", >> "{{=T('Thursday')}}", >> "{{=T('Friday')}}", >> "{{=T('Saturday')}}"], >> dayNamesShort: ["{{=T('Sun')}}", >> "{{=T('Mon')}}", >> "{{=T('Tue')}}", >> "{{=T('Wed')}}", >> "{{=T('Thu')}}", >> "{{=T('Fri')}}", >> "{{=T('Sat')}}"], >> buttonText: { >> prev: ' ◄ ', // left triangle >> next: ' ► ', // right triangle >> prevYear: ' ◄◄ ', // << >> nextYear: ' ►► ', // >> >> today:"{{=T('today')}}", >> month:"{{=T('month')}}", >> week: "{{=T('week')}}", >> day: "{{=T('day')}}" >> } >> >> }); >> >> }); >> >> >> >> Since I save you a lot of time you can consider to update the >> AppointmentManager app with this example to return to community : >> >> >> https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager >> >> Richard >> >> >> >> On Wed, Jun 26, 2013 at 1:31 PM, Tom Russell wrote: >> >>> Well I updated to the latest fullcalendar and it seems to work good, but >>> do not know if the memory leak still exists. By any chance could y
Re: [web2py] sqlform.factory widget in field problem
Another solution can be: {{extend 'layout.html'}} Education CV {{=education_form}} Student {{=student_form}} School {{=school_form}} On Wed, Jun 26, 2013 at 12:47 PM, Tom Russell wrote: > Saved mine too, got it originally from > http://www.web2pyslices.com/slice/show/1457/adding-fieldset-and-legend-to-forms > > > On Wed, Jun 26, 2013 at 12:39 PM, António Ramos wrote: > >> That is a very clever solution. >> Saved my day. >> >> Thank you >> >> >> >> >> 2013/6/26 Tom Russell >> >>> form[0]=TABLE( >>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), >>> FIELDSET(TAG.legend("Emergency Contact >>> Info"),TABLE(fs1),_id="register1"), >>> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), >>> TABLE(fs3)) >>> >> >> >> -- >> >> --- >> 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] Appointment Manager
Well I updated to the latest fullcalendar and it seems to work good, but do not know if the memory leak still exists. By any chance could you share what you did? Also, any chance you added views for week/day in it? You can see in the example here http://arshaw.com/fullcalendar/ that it has buttons for day and week also. I tried fiddling with some examples to get it to show but am not successful yet. Thanks. On Wed, Jun 26, 2013 at 1:22 PM, Richard Vézina wrote: > Letting FullCalendar consume the json feed... > > > On Wed, Jun 26, 2013 at 1:21 PM, Richard Vézina < > ml.richard.vez...@gmail.com> wrote: > >> Take care, I don't know if it has been solve, but I found a memory leak >> in this app caused by the way FullCalendar is integrated... I solve the >> issue for my own need by using the json feed feature of FullCalendar doing >> a simple json feed function returning a well formatted json object with >> simplejson dump. >> >> Richard >> >> >> On Wed, Jun 26, 2013 at 12:55 PM, Tom Russell wrote: >> >>> I am using the appointment manager from >>> https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager >>> . >>> >>> I have tweaked it to my needs and works well so far but there is an >>> issue trying to use SQLFORM.grid. >>> >>> I get an error >>> () takes exactly 1 argument (2 >>> given) >>> >>> by doing this: >>> >>> def appointment_select(): >>> grid = SQLFORM.grid(db.t_appointment, deletable=True, editable=True, >>> create=False, maxtextlength=64, paginate=25) >>> >>> return dict(grid=grid) >>> >>> I cannot figure out why it is doing this. >>> >>> Any ideas? >>> >>> -- >>> >>> --- >>> 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. > > > -- --- 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] Appointment Manager
I am using the appointment manager from https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager . I have tweaked it to my needs and works well so far but there is an issue trying to use SQLFORM.grid. I get an error () takes exactly 1 argument (2 given) by doing this: def appointment_select(): grid = SQLFORM.grid(db.t_appointment, deletable=True, editable=True, create=False, maxtextlength=64, paginate=25) return dict(grid=grid) I cannot figure out why it is doing this. Any ideas? -- --- 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] sqlform.factory widget in field problem
Saved mine too, got it originally from http://www.web2pyslices.com/slice/show/1457/adding-fieldset-and-legend-to-forms On Wed, Jun 26, 2013 at 12:39 PM, António Ramos wrote: > That is a very clever solution. > Saved my day. > > Thank you > > > > > 2013/6/26 Tom Russell > >> form[0]=TABLE( >> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), >> FIELDSET(TAG.legend("Emergency Contact >> Info"),TABLE(fs1),_id="register1"), >> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), >> TABLE(fs3)) >> > > > -- > > --- > 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] Ref another table in another app
How would I do this: I need to create an appointment for a patient so from my list of patients i have a link to call another app to do the appointment. I have the link set so it looks like this: links = [lambda row: A(T('Create Appointment'),_href=URL("AppointmentManager","default", "appointment_create"), args=[row.id])] In the appointment app how do I let it know what to use for the patient? Basically I want to pass in the patient info to the other app and have that displayed in the app. I know you can reference another table but not sure how to do this in this situation. Any suggestions? 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.
Re: [web2py] sqlform.factory widget in field problem
To group inside a field I do something like this with 3 different tables: form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents) fs0=form[0][:26] #patient rows fs1=form[0][26:37] #emergency contacts fs2=form[0][37:41] #dependents fs3=form[0][-1] # submit row (last) form[0]=TABLE( FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), FIELDSET(TAG.legend("Emergency Contact Info"),TABLE(fs1),_id="register1"), FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), TABLE(fs3)) HTH On Wed, Jun 26, 2013 at 11:58 AM, António Ramos wrote: > Just drafting something but here is the problem > > My context: > I have 3 tables > > table form > table steps > table fields > > A form can have many steps > a step can have many fields > > This way i can have one form with 3 steps, each with some fields and > another form with 10 steps , each with some more fields. > > i read these tables to create a form using factory. > > i have 2 problems > > > *1 i need to mark the input fields with a "step" tag * > > here is my code: > > def my_string_widget(field, value,step): > > return INPUT(_name=field.name, > _id="%s_%s" % (field._tablename, field.name), > _class=field.type, > _value='', > *_step=step,* > requires=field.requires) > > def index(): > cont=0 > fields=[] > formid=db.form(request.args(0) or 1) > steps=formid.steps.select() > for step in steps: > print "step id-",step.id > for field in step.fields.select(): > print "field...",field.step > fields.append(Field(field.nome,widget=lambda > field,value:my_string_widget(field,value,*step.id*))) > > form=SQLFORM.factory(*fields) > print form > if form.process().accepted: > response.flash='a gravar registo' > return dict(nome=formid.nome,form=form) > > > The problem is: > It marks all fields with the same "step" value, the last value in *step.id, > why?* > * > * > *2 - sqlformfactory * > how do i group sqlformfactory fields inside a div? > i want to create a section for each step in the form to style with css > > Best regards > António > > -- > > --- > 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] Add button to smartgrid?
I need to add a button to the smartgrid but not like doing create=True because I have a form factory that has 2 other tables associated with the one. I know in html I can simply add a line for a button but since I am not using html for this how would I add a button to that page to reference my own view? 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.
Re: [web2py] Re: SQLFORM.smartgrid
That is awesome, I did not know that! Just when you think its more complicated than not, its easy. So how do I reference that from the dependents table so that in my smart grid it shows the patients name associated with the dependent? Thanks On Wed, Jun 26, 2013 at 10:43 AM, Anthony wrote: > db.define_table('patient', > ..., > format='%(first_name)s %(last_name)s') > > "format" can also be a function that takes a row object and generates the > desired output. > > The "format" attribute is used to create a default "represent" attribute > for any reference fields that reference this table. > > Anthony > > > On Wednesday, June 26, 2013 10:24:32 AM UTC-4, Tom Russell wrote: > >> db.define_table('patient', >> #db.patient.id.readable=False # Since we do not want to expose the id >> field on the grid >> Field('alternatepid', label='Alternate PID', writable=False, >> readable=False), >> Field('first_name', label='First Name', requires=IS_NOT_EMPTY()), >> Field('middle_name', label='Middle Name'), >> Field('last_name', label='Last Name', requires=IS_NOT_EMPTY()), >> Field('suffix', label='Suffix', requires=IS_IN_SET(['I', 'II', 'III', >> 'IV', 'V', 'Jr', 'Sr'])), >> Field('date_of_birth', 'date', label='Date of Birth', >> required=IS_DATE(), requires=IS_NOT_EMPTY()), >> Field('gender', label='Gender', requires=IS_IN_SET(['Male', 'Female', >> 'Other'])), >> Field('full_name', label='Full Name', writable=False, >> readable=False), >> Field('address1', label='Address1', requires=IS_NOT_EMPTY()), >> Field('address2', label='Address2'), >> Field('city', label='City', requires=IS_NOT_EMPTY()), >> Field('state', label='State', requires=IS_NOT_EMPTY()), >> Field('zipcode', label='Zip Code', requires=IS_NOT_EMPTY()), >> Field('addresstype', label='AddressType'), >> Field('county', label='County', ), >> Field('country', label='Country', requires=IS_IN_SET(COUNTRIES))**, >> Field('phone', label='Phone', ), >> Field('mobile_phone', label='Mobile Phone'), >> Field('emailaddress', label='Email Address', requires = >> IS_EMAIL(error_message='**invalid email!')), >> Field('ethnicity', label='Ethnicity', requires=IS_IN_SET(['**Caucasian', >> 'Hispanic', 'Chinese'])), >> Field('age', label='Age'), >> Field('marital_status', label='Marital Status', >> requires=IS_IN_SET(['Single', 'Married', 'Divorced', 'Separated', >> 'Widowed'])), >> Field('comment', 'text', label='Comment'), >> Field('government_id_number', label='Government ID Number', >> requires=IS_NOT_EMPTY()), >> Field('is_newborn', 'boolean', label='Is Newborn', ), >> Field('medical_record_number', label='MRN', readable=True, >> requires=IS_NOT_EMPTY()), >> Field('other_id_type', label='Other ID Type', >> requires=IS_IN_SET(['Work', 'Library Card', 'Drivers License', 'School ID', >> 'Other'])), >> Field('other_id', label='Other ID'), >> ) >> >> >> db.define_table( >> 'dependents', >> #Field('patient name', db.linked patient, represent=lambda c, >> row:first_name of patient(c), requires=IS_IN_DB(db,'field.id** >> ','%(patient)s')), >> Field('patient','reference patient', writable=False, readable=False), >> Field('dep_firstname', label='First Name'), >> Field('dep_middlename', label='Middle Name'), >> Field('dep_lastname', label='Last Name'), >> Field('dep_relationship', label='Relationship', >> requires=IS_IN_SET(['Son', 'Daughter', 'Other'])), >> ) &
Re: [web2py] Re: SQLFORM.smartgrid
db.define_table('patient', #db.patient.id.readable=False # Since we do not want to expose the id field on the grid Field('alternatepid', label='Alternate PID', writable=False, readable=False), Field('first_name', label='First Name', requires=IS_NOT_EMPTY()), Field('middle_name', label='Middle Name'), Field('last_name', label='Last Name', requires=IS_NOT_EMPTY()), Field('suffix', label='Suffix', requires=IS_IN_SET(['I', 'II', 'III', 'IV', 'V', 'Jr', 'Sr'])), Field('date_of_birth', 'date', label='Date of Birth', required=IS_DATE(), requires=IS_NOT_EMPTY()), Field('gender', label='Gender', requires=IS_IN_SET(['Male', 'Female', 'Other'])), Field('full_name', label='Full Name', writable=False, readable=False), Field('address1', label='Address1', requires=IS_NOT_EMPTY()), Field('address2', label='Address2'), Field('city', label='City', requires=IS_NOT_EMPTY()), Field('state', label='State', requires=IS_NOT_EMPTY()), Field('zipcode', label='Zip Code', requires=IS_NOT_EMPTY()), Field('addresstype', label='AddressType'), Field('county', label='County', ), Field('country', label='Country', requires=IS_IN_SET(COUNTRIES)), Field('phone', label='Phone', ), Field('mobile_phone', label='Mobile Phone'), Field('emailaddress', label='Email Address', requires = IS_EMAIL(error_message='invalid email!')), Field('ethnicity', label='Ethnicity', requires=IS_IN_SET(['Caucasian', 'Hispanic', 'Chinese'])), Field('age', label='Age'), Field('marital_status', label='Marital Status', requires=IS_IN_SET(['Single', 'Married', 'Divorced', 'Separated', 'Widowed'])), Field('comment', 'text', label='Comment'), Field('government_id_number', label='Government ID Number', requires=IS_NOT_EMPTY()), Field('is_newborn', 'boolean', label='Is Newborn', ), Field('medical_record_number', label='MRN', readable=True, requires=IS_NOT_EMPTY()), Field('other_id_type', label='Other ID Type', requires=IS_IN_SET(['Work', 'Library Card', 'Drivers License', 'School ID', 'Other'])), Field('other_id', label='Other ID'), ) db.define_table( 'dependents', #Field('patient name', db.linked patient, represent=lambda c, row:first_name of patient(c), requires=IS_IN_DB(db,'field.id ','%(patient)s')), Field('patient','reference patient', writable=False, readable=False), Field('dep_firstname', label='First Name'), Field('dep_middlename', label='Middle Name'), Field('dep_lastname', label='Last Name'), Field('dep_relationship', label='Relationship', requires=IS_IN_SET(['Son', 'Daughter', 'Other'])), ) db.define_table( 'emergencycontacts', Field('patient','reference patient', writable=False, readable=False), Field('em_first_name', label='First Name'), Field('em_middle_name', label='Middle Name'), Field('em_last_name', label='Last Name'), Field('em_address1', label='Address1'), Field('em_address2', label='Address2'), Field('em_city', label='City'), Field('em_state', label='State'), Field('em_zipcode', label='Zip Code'), Field('em_country', label='Country', requires=IS_IN_SET(COUNTRIES)), Field('em_phone', label='Phone'), Field('em_relationship', label='Relationship', requires=IS_IN_SET(['Aunt', 'Uncle', 'Parent', 'Sibling', 'Spouse', 'Guardian'])), ) I'd like to reference the first and last name of the patient the record is associated with. Thanks. On Wed, Jun 26, 2013 at 10:20 AM, Anthony wrote: > Can you show your three table definitions? The simplest method is just to > specify a "format" attribute for db.patient, which will be used by any > referencing fields. > > Anthony > > > On Wednesday, June 26, 2013 1:06:03 AM UTC-4, Tom Russell wrote: >> >> Another question on the smartgrid. >> >> I have linked tables in my smartgrid like: >> >> grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, >> create=False, maxtextlength=64, paginate=25, links=links, >> links_in_grid=True, linked_tables=['**emergencycontacts','** >> dependents']) >> >> When clicking on the linked table it shows the id of patient since thats >> what reference but how can I show the name of the patient rather than the >> id of patient? >> >> Thanks, >> >> Tom >> > -- > > --- > 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: SQLFORM.smartgrid
Apparently something is not correct as I cannot figure out what the syntax erro is based on the example you gave here. This is what I have: Field('patient name', db.linked patient, represent=lambda c, row:first_name of patient(c), requires=IS_IN_DB(db,'field.id','%(patient)s')), On Wed, Jun 26, 2013 at 2:49 AM, Rohitraj Sharma < rohitraj.sha...@themislexsol.com> wrote: > You can use labda function in your db > > Field('companyField name',db.linked table name, represent=lambda c, > row:field name of linked table(c), requires=IS_IN_DB(db,'field.id > ','%(patient)s')), > > > On Wednesday, 26 June 2013 10:36:03 UTC+5:30, Tom Russell wrote: >> >> Another question on the smartgrid. >> >> I have linked tables in my smartgrid like: >> >> grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, >> create=False, maxtextlength=64, paginate=25, links=links, >> links_in_grid=True, linked_tables=['**emergencycontacts','** >> dependents']) >> >> When clicking on the linked table it shows the id of patient since thats >> what reference but how can I show the name of the patient rather than the >> id of patient? >> >> Thanks, >> >> Tom >> > -- > > --- > 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] SQLFORM.smartgrid
Another question on the smartgrid. I have linked tables in my smartgrid like: grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, create=False, maxtextlength=64, paginate=25, links=links, links_in_grid=True, linked_tables=['emergencycontacts','dependents']) When clicking on the linked table it shows the id of patient since thats what reference but how can I show the name of the patient rather than the id of patient? Thanks, Tom -- --- 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 Links
Ah I see now, Thanks. On Tue, Jun 25, 2013 at 1:31 PM, Anthony wrote: > If you only provide two positional args to URL, it assumes they are the > controller and function. In this case, you'll need to specify the > application, controller, and function: > > URL("AppointmentManager", "yourcontroller", "appointment_create", args=[ > row.id]) > > You can also used keyword arguments "a", "c", and "f" with URL(). > > Anthony > > On Tuesday, June 25, 2013 12:08:57 PM UTC-4, Tom Russell wrote: >> >> I have a smartgrid with a link like so: >> >> links = [lambda row: A(T('Create Appointment'),_href=URL("** >> AppointmentManager","**appointment_create",args=[row.**id <http://row.id> >> ]))] >> >> grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, >> create=True, maxtextlength=64, paginate=25, links=links, >> links_in_grid=True, linked_tables=['**emergencycontacts','** >> dependents']) >> return dict(grid=grid) >> >> Problem is that AppointmentManager is another app and the url points to >> /currentapp/**AppointmentManager/ etc, so how do I have it redirect to >> the other app? >> >> I looked in the book but could'nt find this. >> >> Thanks >> >> Tom >> > -- > > --- > 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: Confused about app
Ah, I forgot to add the following line to my consumer app: auth = Auth(db,cas_provider = ' http://127.0.0.1:8000/welcome/default/user/cas') On Tue, Jun 25, 2013 at 10:12 AM, Tom Russell wrote: > Well agreed, but I set that up in the welcome app so it would seem like > that should move over to my other app as well? > > > On Tue, Jun 25, 2013 at 2:24 AM, Niphlod wrote: > >> every app has its own auth system. If you want multiple apps to share the >> same "auth system", look at >> >> http://web2py.com/books/default/chapter/29/09#Central-Authentication-Service >> >> Il giorno martedì 25 giugno 2013 07:51:08 UTC+2, Tom Russell ha scritto: >> >>> So I took and modified the welcome app to my needs and added another >>> app. If I login with the welcome app and with a link, open the other app >>> and have it set with auth.requires_login(), it requires the user to login >>> again. How does one handle this stuff in web2py? Do I need another app the >>> way I have it now? >>> >>> I am in the mindset of how they do things in django. >>> >>> Thanks, >>> >>> Tom >>> >> -- >> >> --- >> 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] Smartgrid Links
I have a smartgrid with a link like so: links = [lambda row: A(T('Create Appointment'),_href=URL("AppointmentManager","appointment_create",args=[ row.id]))] grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, create=True, maxtextlength=64, paginate=25, links=links, links_in_grid=True, linked_tables=['emergencycontacts','dependents']) return dict(grid=grid) Problem is that AppointmentManager is another app and the url points to /currentapp/AppointmentManager/ etc, so how do I have it redirect to the other app? I looked in the book but could'nt find this. Thanks Tom -- --- 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: Confused about app
But I do like this: ## create all tables needed by auth if not custom tables auth.define_tables(username=True, signature=True) I was using auth.signature for each table but that gave me an error after setting the CAS stuff. Once commented out it works fine. I was getting a 'DAL' object has no attribute 'auth_user' On Tue, Jun 25, 2013 at 11:14 AM, Anthony wrote: > On Tuesday, June 25, 2013 11:04:22 AM UTC-4, Tom Russell wrote: > >> Yes I customized welcome and then added a new app via the admin >> interface. I did not directly copy the welcome app, just modified the html >> etc. >> >> Now I am really confused about how this all works. So when I fire up >> web2py and create a new app via the admin, should that be my only app then? >> > > No, create as many apps as you like. However, each app is separate (a > web2py app is more like a Django project). > > >> So I did implement the CAS stuff but now I get an error saying 'DAL' >> object has no attribute 'auth_user' for the app I have. >> > > Sounds like you didn't call auth.define_tables() in the second app. > > Anthony > > -- > > --- > 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: Confused about app
Yes I customized welcome and then added a new app via the admin interface. I did not directly copy the welcome app, just modified the html etc. Now I am really confused about how this all works. So when I fire up web2py and create a new app via the admin, should that be my only app then? So I did implement the CAS stuff but now I get an error saying 'DAL' object has no attribute 'auth_user' for the app I have. On Tue, Jun 25, 2013 at 10:53 AM, Anthony wrote: > On Tuesday, June 25, 2013 10:12:32 AM UTC-4, Tom Russell wrote: > >> Well agreed, but I set that up in the welcome app so it would seem like >> that should move over to my other app as well? >> > > Are you saying you customized the welcome app and then used admin to > create a new app? In that case, note that new apps are not created by > directly copying the existing welcome app folder. Instead, they are created > by unpacking the welcome.w2p file in the /web2py root folder. > > Even if you did get an exact copy of your custom welcome app, including > the database with the records in db.auth_user (or a connection to a shared > database), logging into one app would not log you into the other. The > reason is that login status is held in the session, and by default, > sessions are not shared across apps (though they can be shared if desired). > If you want Auth to work across multiple apps, the best option is probably > http://web2py.com/books/**default/chapter/29/09#Central-** > Authentication-Service<http://web2py.com/books/default/chapter/29/09#Central-Authentication-Service> > . > > Anthony > > -- > > --- > 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] Multi Table Form
I have the following form that uses 3 different tables and when I submit the data it all seems to submit correctly but when I view the data in a smart grid with linked tables in the columns clicking on the link does not show any record for the row of linked data. My smartgrid code: def manage_patients(): db.patient.id.readable=False # Since we do not want to expose the id field on the grid grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, create=True, maxtextlength=64, paginate=25, linked_tables=['emergencycontacts','dependents']) return dict(grid=grid) My linked tables: db.define_table( 'dependents', Field('dep_id',db.patient, writable=False, readable=False), Field('dep_firstname', label='First Name'), Field('dep_middlename', label='Middle Name'), Field('dep_lastname', label='Last Name'), Field('dep_relationship', label='Relationship', requires=IS_IN_SET(['Aunt', 'Uncle', 'Parent', 'Sibling', 'Spouse', 'Guardian'])), auth.signature) db.define_table( 'emergencycontacts', Field('ec_id',db.patient, writable=False, readable=False), Field('em_first_name', label='First Name'), Field('em_middle_name', label='Middle Name'), Field('em_last_name', label='Last Name'), Field('em_address1', label='Address1'), Field('em_address2', label='Address2'), Field('em_city', label='City'), Field('em_state', label='State'), Field('em_zipcode', label='Zip Code'), Field('em_country', label='Country'), Field('em_phone', label='Phone'), Field('em_relationship', label='Relationship', requires=IS_IN_SET(['Aunt', 'Uncle', 'Parent', 'Sibling', 'Spouse', 'Guardian'])), auth.signature) I believe I am doing this correctly but cannot bring up the data for each row to the linked tables. Any ideas? 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.
Re: [web2py] Re: Confused about app
Well agreed, but I set that up in the welcome app so it would seem like that should move over to my other app as well? On Tue, Jun 25, 2013 at 2:24 AM, Niphlod wrote: > every app has its own auth system. If you want multiple apps to share the > same "auth system", look at > > http://web2py.com/books/default/chapter/29/09#Central-Authentication-Service > > Il giorno martedì 25 giugno 2013 07:51:08 UTC+2, Tom Russell ha scritto: > >> So I took and modified the welcome app to my needs and added another app. >> If I login with the welcome app and with a link, open the other app and >> have it set with auth.requires_login(), it requires the user to login >> again. How does one handle this stuff in web2py? Do I need another app the >> way I have it now? >> >> I am in the mindset of how they do things in django. >> >> Thanks, >> >> Tom >> > -- > > --- > 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] Confused about app
So I took and modified the welcome app to my needs and added another app. If I login with the welcome app and with a link, open the other app and have it set with auth.requires_login(), it requires the user to login again. How does one handle this stuff in web2py? Do I need another app the way I have it now? I am in the mindset of how they do things in django. Thanks, Tom -- --- 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: Form Field
Yes I just tried it and that works fine. That works as expected. Thanks for the help. Exactly what I was looking for to begin with. On Tue, Jun 25, 2013 at 1:23 AM, Anthony wrote: > Did you try this method (setting these before creating the form): > > db.mytable.myfield.default = some_value > db.mytable.myfield.writable = False > > Anthony > > On Tuesday, June 25, 2013 1:02:40 AM UTC-4, Tom Russell wrote: > >> Yes I understand that. What would be the best way to handle this? >> Seemingly, the couple of items suggested did not work for me so I am not >> sure where that leaves me. >> >> >> On Tue, Jun 25, 2013 at 12:35 AM, Anthony wrote: >> >>> Yes that works, though it's not as secure because someone can still >>> submit a value for that field if they are determined, so you might want to >>> check for that variable on the server and delete it if submitted. >>> >>> Anthony >>> >>> >>> On Tuesday, June 25, 2013 12:15:04 AM UTC-4, Tom Russell wrote: >>> >>>> I ended up doing this in the controller which works for what I need: >>>> >>>> form.element('#no_table_**medica**l_record_number')['_**readonly']** >>>> =True >>>> >>>> >>>> On Tue, Jun 25, 2013 at 12:03 AM, Anthony wrote: >>>> >>>>> I'm not sure that method will work for readonly fields, so you may >>>>> have to use the method I showed (i.e., set the default value for the field >>>>> before creating the form). >>>>> >>>>> Anthony >>>>> >>>>> >>>>> On Monday, June 24, 2013 11:23:01 PM UTC-4, Tom Russell wrote: >>>>> >>>>>> Yes I tried that: >>>>>> >>>>>> Field('medical_record_number', label='MRN', writable=False, >>>>>> readable=True, requires=IS_NOT_EMPTY()), >>>>>> >>>>>> Still just shows none for the field on the form. >>>>>> >>>>>> In my controller this is what I am doing: >>>>>> >>>>>> form.vars.medical_record_**number = 'KND' + >>>>>> str(date.today().year) + '' + str(random.randrange(1, 999+1)) >>>>>> >>>>>> If I set both to True then it shows the value no problem. >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Tom >>>>>> >>>>>> >>>>>> On Mon, Jun 24, 2013 at 11:17 PM, Anthony wrote: >>>>>> >>>>>>> db.mytable.myfield.default = some_value >>>>>>> db.mytable.myfield.writable = False >>>>>>> >>>>>>> Leave readable at True in order to show the value but not allow it >>>>>>> to be edited. >>>>>>> >>>>>>> Anthony >>>>>>> >>>>>>> >>>>>>> On Monday, June 24, 2013 11:00:59 PM UTC-4, Tom Russell wrote: >>>>>>>> >>>>>>>> I have a form and I load a pre existing value that I generate >>>>>>>> internally before I call the form. What I want to see on the form is >>>>>>>> the >>>>>>>> value shown up but just as plain text so the user cannot modify it. If >>>>>>>> I do >>>>>>>> readable-False then it just shows None for the value rather than the >>>>>>>> value. >>>>>>>> >>>>>>>> How would I make that happen on the form then? >>>>>>>> >>>>>>>> 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+un...@**googlegroups.com. >>>>>>> >>>>>>> For more options, visit https://groups.google.com/**grou >>>>>>> ps/opt_out <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+un...@**googlegroups.com. >>>>> For more options, visit >>>>> https://groups.google.com/**grou**ps/opt_out<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+un...@**googlegroups.com. >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<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. > > > -- --- 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: Form Field
Yes I understand that. What would be the best way to handle this? Seemingly, the couple of items suggested did not work for me so I am not sure where that leaves me. On Tue, Jun 25, 2013 at 12:35 AM, Anthony wrote: > Yes that works, though it's not as secure because someone can still submit > a value for that field if they are determined, so you might want to check > for that variable on the server and delete it if submitted. > > Anthony > > > On Tuesday, June 25, 2013 12:15:04 AM UTC-4, Tom Russell wrote: > >> I ended up doing this in the controller which works for what I need: >> >> form.element('#no_table_**medical_record_number')['_**readonly']=True >> >> >> On Tue, Jun 25, 2013 at 12:03 AM, Anthony wrote: >> >>> I'm not sure that method will work for readonly fields, so you may have >>> to use the method I showed (i.e., set the default value for the field >>> before creating the form). >>> >>> Anthony >>> >>> >>> On Monday, June 24, 2013 11:23:01 PM UTC-4, Tom Russell wrote: >>> >>>> Yes I tried that: >>>> >>>> Field('medical_record_number', label='MRN', writable=False, >>>> readable=True, requires=IS_NOT_EMPTY()), >>>> >>>> Still just shows none for the field on the form. >>>> >>>> In my controller this is what I am doing: >>>> >>>> form.vars.medical_record_**numbe**r = 'KND' + str(date.today().year) + >>>> '' + str(random.randrange(1, 999+1)) >>>> >>>> If I set both to True then it shows the value no problem. >>>> >>>> Thanks, >>>> >>>> Tom >>>> >>>> >>>> On Mon, Jun 24, 2013 at 11:17 PM, Anthony wrote: >>>> >>>>> db.mytable.myfield.default = some_value >>>>> db.mytable.myfield.writable = False >>>>> >>>>> Leave readable at True in order to show the value but not allow it to >>>>> be edited. >>>>> >>>>> Anthony >>>>> >>>>> >>>>> On Monday, June 24, 2013 11:00:59 PM UTC-4, Tom Russell wrote: >>>>>> >>>>>> I have a form and I load a pre existing value that I generate >>>>>> internally before I call the form. What I want to see on the form is the >>>>>> value shown up but just as plain text so the user cannot modify it. If I >>>>>> do >>>>>> readable-False then it just shows None for the value rather than the >>>>>> value. >>>>>> >>>>>> How would I make that happen on the form then? >>>>>> >>>>>> 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+un...@**googlegroups.com. >>>>> >>>>> For more options, visit >>>>> https://groups.google.com/**grou**ps/opt_out<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+un...@**googlegroups.com. >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<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. > > > -- --- 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: Form Field
I ended up doing this in the controller which works for what I need: form.element('#no_table_medical_record_number')['_readonly']=True On Tue, Jun 25, 2013 at 12:03 AM, Anthony wrote: > I'm not sure that method will work for readonly fields, so you may have to > use the method I showed (i.e., set the default value for the field before > creating the form). > > Anthony > > > On Monday, June 24, 2013 11:23:01 PM UTC-4, Tom Russell wrote: > >> Yes I tried that: >> >> Field('medical_record_number', label='MRN', writable=False, >> readable=True, requires=IS_NOT_EMPTY()), >> >> Still just shows none for the field on the form. >> >> In my controller this is what I am doing: >> >> form.vars.medical_record_**number = 'KND' + str(date.today().year) + >> '' + str(random.randrange(1, 999+1)) >> >> If I set both to True then it shows the value no problem. >> >> Thanks, >> >> Tom >> >> >> On Mon, Jun 24, 2013 at 11:17 PM, Anthony wrote: >> >>> db.mytable.myfield.default = some_value >>> db.mytable.myfield.writable = False >>> >>> Leave readable at True in order to show the value but not allow it to be >>> edited. >>> >>> Anthony >>> >>> >>> On Monday, June 24, 2013 11:00:59 PM UTC-4, Tom Russell wrote: >>>> >>>> I have a form and I load a pre existing value that I generate >>>> internally before I call the form. What I want to see on the form is the >>>> value shown up but just as plain text so the user cannot modify it. If I do >>>> readable-False then it just shows None for the value rather than the value. >>>> >>>> How would I make that happen on the form then? >>>> >>>> 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+un...@**googlegroups.com. >>> >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<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. > > > -- --- 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: Form Field
Yes I tried that: Field('medical_record_number', label='MRN', writable=False, readable=True, requires=IS_NOT_EMPTY()), Still just shows none for the field on the form. In my controller this is what I am doing: form.vars.medical_record_number = 'KND' + str(date.today().year) + '' + str(random.randrange(1, 999+1)) If I set both to True then it shows the value no problem. Thanks, Tom On Mon, Jun 24, 2013 at 11:17 PM, Anthony wrote: > db.mytable.myfield.default = some_value > db.mytable.myfield.writable = False > > Leave readable at True in order to show the value but not allow it to be > edited. > > Anthony > > > On Monday, June 24, 2013 11:00:59 PM UTC-4, Tom Russell wrote: >> >> I have a form and I load a pre existing value that I generate internally >> before I call the form. What I want to see on the form is the value shown >> up but just as plain text so the user cannot modify it. If I do >> readable-False then it just shows None for the value rather than the value. >> >> How would I make that happen on the form then? >> >> 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] Form Field
I have a form and I load a pre existing value that I generate internally before I call the form. What I want to see on the form is the value shown up but just as plain text so the user cannot modify it. If I do readable-False then it just shows None for the value rather than the value. How would I make that happen on the form then? 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.
Re: [web2py] Re: SQLForm Factory
Ah yes both readable and writable have to be defined. Thanks again On Mon, Jun 24, 2013 at 6:12 PM, Anthony wrote: > Try writable=False. > > > On Monday, June 24, 2013 6:04:43 PM UTC-4, Tom Russell wrote: > >> Thanks for the tip. >> >> I did set one field to not be readable like this: >> >> Field('alternatepid', label='Alternate PID', readable=False), >> >> but it still shows on my form. >> >> Should'nt be there should it? >> >> Thanks. >> >> >> On Mon, Jun 24, 2013 at 1:57 PM, Anthony wrote: >> >>> db.patient(fields=['first_**name']) >>> >>> No, the above isn't web2py syntax -- don't know where you saw that. As I >>> mentioned, to control which fields are shown, you can set the readable and >>> writable attributes of the fields (check the book), or you can list >>> individual fields instead of entire tables: >>> >>> SQLFORM.factory(db.mytable.myf**ield, db.mytable.myotherfield, db. >>> wholetable) >>> >>> Anthony >>> >>> >>> On Monday, June 24, 2013 11:49:43 AM UTC-4, Tom Russell wrote: >>> >>>> I tried doing the specific fields like: >>>> >>>> form=SQLFORM.factory(db.**patien**t(fields=['first_name'])**, >>>> db.emergencycontacts, db.dependents, formstyle = 'table3cols') >>>> >>>> but that just throws an error saying no tables selected. I guess what I >>>> am trying to do is set certain fields to be show for each table and read >>>> the book but do not see how I would set it in my code as such. All of the >>>> examples I have seen so far show only 1 table at a time. >>>> >>>> >>>> On Mon, Jun 24, 2013 at 11:29 AM, Anthony wrote: >>>> >>>>> You can set the readable and writable attributes of the fields, or >>>>> .factory() can take a list of specific fields rather than entire tables. >>>>> >>>>> Anthony >>>>> >>>>> >>>>> On Monday, June 24, 2013 11:15:28 AM UTC-4, Tom Russell wrote: >>>>>> >>>>>> If I have a form factory with 3 tables, how would I define the fields >>>>>> I wanted shown for each? >>>>>> >>>>>> This is the code for my controller. I have tried to set it in several >>>>>> spots but all of them throw an error. >>>>>> >>>>>> def register_patient(): >>>>>> mark_not_empty(db.patient) >>>>>> mark_not_empty(db.**emergencycontacts) >>>>>> mark_not_empty(db.dependents) >>>>>> form=SQLFORM.factory(db.**patient, db.emergencycontacts, >>>>>> db.dependents, formstyle = 'table3cols') >>>>>> fs0=form[0][:28] # the first two name rows >>>>>> fs1=form[0][28:40] # the wine data rows (all but the last) >>>>>> fs2=form[0][40:45] # submit row (last) >>>>>> fs3=form[0][-1] # submit row (last) >>>>>> >>>>>> form.vars.medical_record_**number = 'KND' + >>>>>> str(date.today().year) + '' + str(random.randrange(1, 999+1)) >>>>>> >>>>>> form[0]=TABLE( >>>>>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="**registe >>>>>> r0"), >>>>>> FIELDSET(TAG.legend("Emergency Contact Info"),TABLE(fs1),_id="** >>>>>> register1"), >>>>>> FIELDSET(TAG.legend("**Dependents"),TABLE(fs2),_id="** >>>>>> register2"), >>>>>> TABLE(fs3)) >>>>>> if form.process().accepted: >>>>>> id = db.patient.insert(**db.**patient >>>>>> ._filter_fields(form.**vars)) >>>>>> form.vars.patient=id >>>>>> id = db.emergencycontacts.insert( >>>>>> db.emergencycontacts._filter_**fields(form.vars)) >>>>>> response.flash='Thanks for filling the form' >>>>>> id = db.dependents.insert(**db.**depe >>>>>> ndents._filter_fields(**form.**var**s)) >>>>>> form.vars.dependents=id >>>>>> # and get a list of all pers
Re: [web2py] Re: SQLForm Factory
Thanks for the tip. I did set one field to not be readable like this: Field('alternatepid', label='Alternate PID', readable=False), but it still shows on my form. Should'nt be there should it? Thanks. On Mon, Jun 24, 2013 at 1:57 PM, Anthony wrote: > db.patient(fields=['first_name']) > > No, the above isn't web2py syntax -- don't know where you saw that. As I > mentioned, to control which fields are shown, you can set the readable and > writable attributes of the fields (check the book), or you can list > individual fields instead of entire tables: > > SQLFORM.factory(db.mytable.myfield, db.mytable.myotherfield, db.wholetable > ) > > Anthony > > > On Monday, June 24, 2013 11:49:43 AM UTC-4, Tom Russell wrote: > >> I tried doing the specific fields like: >> >> form=SQLFORM.factory(db.**patient(fields=['first_name'])**, >> db.emergencycontacts, db.dependents, formstyle = 'table3cols') >> >> but that just throws an error saying no tables selected. I guess what I >> am trying to do is set certain fields to be show for each table and read >> the book but do not see how I would set it in my code as such. All of the >> examples I have seen so far show only 1 table at a time. >> >> >> On Mon, Jun 24, 2013 at 11:29 AM, Anthony wrote: >> >>> You can set the readable and writable attributes of the fields, or >>> .factory() can take a list of specific fields rather than entire tables. >>> >>> Anthony >>> >>> >>> On Monday, June 24, 2013 11:15:28 AM UTC-4, Tom Russell wrote: >>>> >>>> If I have a form factory with 3 tables, how would I define the fields I >>>> wanted shown for each? >>>> >>>> This is the code for my controller. I have tried to set it in several >>>> spots but all of them throw an error. >>>> >>>> def register_patient(): >>>> mark_not_empty(db.patient) >>>> mark_not_empty(db.**emergencycon**tacts) >>>> mark_not_empty(db.dependents) >>>> form=SQLFORM.factory(db.**patien**t, db.emergencycontacts, >>>> db.dependents, formstyle = 'table3cols') >>>> fs0=form[0][:28] # the first two name rows >>>> fs1=form[0][28:40] # the wine data rows (all but the last) >>>> fs2=form[0][40:45] # submit row (last) >>>> fs3=form[0][-1] # submit row (last) >>>> >>>> form.vars.medical_record_**numbe**r = 'KND' + >>>> str(date.today().year) + '' + str(random.randrange(1, 999+1)) >>>> >>>> form[0]=TABLE( >>>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="**registe** >>>> r0"), >>>> FIELDSET(TAG.legend("Emergency Contact Info"),TABLE(fs1),_id="** >>>> registe**r1"), >>>> FIELDSET(TAG.legend("**Dependent**s"),TABLE(fs2),_id="**register2"* >>>> *), >>>> TABLE(fs3)) >>>> if form.process().accepted: >>>> id = db.patient.insert(**db.**patient**._filter_fields(form.** >>>> vars)) >>>> form.vars.patient=id >>>> id = db.emergencycontacts.insert(** >>>> db.emergencycontacts._filter_**f**ields(form.vars)) >>>> response.flash='Thanks for filling the form' >>>> id = db.dependents.insert(**db.**depe**ndents._filter_fields(** >>>> form.**vars)) >>>> form.vars.dependents=id >>>> # and get a list of all persons >>>> redirect(URL('manage_patients')) >>>> >>>> style = STYLE(""".not_empty {color:#d00;}""") >>>> >>>> return dict(form=DIV(style,form)) >>>> >>>> >>>> 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+un...@**googlegroups.com. >>> >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<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. > > > -- --- 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: SQLForm Factory
I tried doing the specific fields like: form=SQLFORM.factory(db.patient(fields=['first_name']), db.emergencycontacts, db.dependents, formstyle = 'table3cols') but that just throws an error saying no tables selected. I guess what I am trying to do is set certain fields to be show for each table and read the book but do not see how I would set it in my code as such. All of the examples I have seen so far show only 1 table at a time. On Mon, Jun 24, 2013 at 11:29 AM, Anthony wrote: > You can set the readable and writable attributes of the fields, or > .factory() can take a list of specific fields rather than entire tables. > > Anthony > > > On Monday, June 24, 2013 11:15:28 AM UTC-4, Tom Russell wrote: >> >> If I have a form factory with 3 tables, how would I define the fields I >> wanted shown for each? >> >> This is the code for my controller. I have tried to set it in several >> spots but all of them throw an error. >> >> def register_patient(): >> mark_not_empty(db.patient) >> mark_not_empty(db.**emergencycontacts) >> mark_not_empty(db.dependents) >> form=SQLFORM.factory(db.**patient, db.emergencycontacts, >> db.dependents, formstyle = 'table3cols') >> fs0=form[0][:28] # the first two name rows >> fs1=form[0][28:40] # the wine data rows (all but the last) >> fs2=form[0][40:45] # submit row (last) >> fs3=form[0][-1] # submit row (last) >> >> form.vars.medical_record_**number = 'KND' + str(date.today().year) + >> '' + str(random.randrange(1, 999+1)) >> >> form[0]=TABLE( >> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="**register0"), >> FIELDSET(TAG.legend("Emergency Contact Info"),TABLE(fs1),_id="** >> register1"), >> FIELDSET(TAG.legend("**Dependents"),TABLE(fs2),_id="**register2"), >> TABLE(fs3)) >> if form.process().accepted: >> id = db.patient.insert(**db.**patient._filter_fields(form.** >> vars)) >> form.vars.patient=id >> id = db.emergencycontacts.insert( >> db.emergencycontacts._filter_**fields(form.vars)) >> response.flash='Thanks for filling the form' >> id = db.dependents.insert(**db.**dependents._filter_fields(** >> form.vars)) >> form.vars.dependents=id >> # and get a list of all persons >> redirect(URL('manage_patients'**)) >> >> style = STYLE(""".not_empty {color:#d00;}""") >> >> return dict(form=DIV(style,form)) >> >> >> 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] SQLForm Factory
If I have a form factory with 3 tables, how would I define the fields I wanted shown for each? This is the code for my controller. I have tried to set it in several spots but all of them throw an error. def register_patient(): mark_not_empty(db.patient) mark_not_empty(db.emergencycontacts) mark_not_empty(db.dependents) form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents, formstyle = 'table3cols') fs0=form[0][:28] # the first two name rows fs1=form[0][28:40] # the wine data rows (all but the last) fs2=form[0][40:45] # submit row (last) fs3=form[0][-1] # submit row (last) form.vars.medical_record_number = 'KND' + str(date.today().year) + '' + str(random.randrange(1, 999+1)) form[0]=TABLE( FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), FIELDSET(TAG.legend("Emergency Contact Info"),TABLE(fs1),_id="register1"), FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), TABLE(fs3)) if form.process().accepted: id = db.patient.insert(**db.patient._filter_fields(form.vars)) form.vars.patient=id id = db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars)) response.flash='Thanks for filling the form' id = db.dependents.insert(**db.dependents._filter_fields(form.vars)) form.vars.dependents=id # and get a list of all persons redirect(URL('manage_patients')) style = STYLE(""".not_empty {color:#d00;}""") return dict(form=DIV(style,form)) 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.
Re: [web2py] Re: Change form layout
Ah, I see now. Thanks On Mon, Jun 24, 2013 at 10:50 AM, Anthony wrote: > No, 3 columns means: > > Col 1 Col 2 Col 3 > label widget comment > > It's still one field per row. When in doubt, try it out. :-) > > Anthony > > > On Monday, June 24, 2013 10:26:08 AM UTC-4, Tom Russell wrote: > >> Thanks again for the info. >> >> I guess I still do not get it though if I set my formstyle to table3cols >> would'nt my form at least be laid out like: >> >> Name Address City >> State >> >> Or am I not looking at this correctly? >> >> >> On Mon, Jun 24, 2013 at 10:16 AM, Anthony wrote: >> >>> Your best bet is to look at how the built-in ones work, starting here: >>> https://code.google.com/**p/web2py/source/browse/gluon/**sqlhtml.py#752<https://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#752>. >>> Copy the one of those that is closest to what you want and modify it as >>> necessary. >>> >>> def myformstyle(): >>> [custom code here] >>> >>> form = SQLFORM(..., formstyle=myformstyle) >>> >>> Anthony >>> >>> >>> On Monday, June 24, 2013 10:07:49 AM UTC-4, Tom Russell wrote: >>> >>>> Thanks for the responses. >>>> >>>> The formstyle looks interesting but I cannot make heads or tails out of >>>> the way to use it. Are there any examples of this some place? >>>> >>>> Thanks >>>> >>>> >>>> On Mon, Jun 24, 2013 at 9:55 AM, Anthony wrote: >>>> >>>>> I assume that means you are relying on a generic view to display your >>>>> table. If so, you can instead create a non-generic view (which you should >>>>> probably do anyway), or you can build the form DOM on the server using >>>>> web2py HTML helpers (probably not the way to go). The custom formstyle >>>>> option also does not require any HTML coding. >>>>> >>>>> Anthony >>>>> >>>>> >>>>> On Monday, June 24, 2013 9:35:31 AM UTC-4, Tom Russell wrote: >>>>> >>>>>> Thanks for the response. So now I am really confused because I have >>>>>> no idea where to put this code if I am using a SQLFORM.factory? >>>>>> >>>>>> Basically I just want to add row fluid to make the layout a little >>>>>> easier to navigate. I do not have a html file to set this code in for >>>>>> this >>>>>> form. >>>>>> >>>>>> Thanks. >>>>>> >>>>>> >>>>>> On Mon, Jun 24, 2013 at 9:04 AM, Anthony wrote: >>>>>> >>>>>>> http://web2py.com/books/**default/chapter/29/07#Custom-**forms<http://web2py.com/books/default/chapter/29/07#Custom-forms> >>>>>>> >>>>>>> I don't think it's in the book yet, but you can also create a custom >>>>>>> formstyle if you need to use the layout in multiple places: >>>>>>> https://groups.google.**com/d/msg/web2py/QmoRmapiOwA/**t >>>>>>> ZqeEbii6QgJ<https://groups.google.com/d/msg/web2py/QmoRmapiOwA/tZqeEbii6QgJ> >>>>>>> >>>>>>> Anthony >>>>>>> >>>>>>> >>>>>>> On Monday, June 24, 2013 8:53:16 AM UTC-4, Tom Russell wrote: >>>>>>>> >>>>>>>> I have a SQLForm and use the formset DIV for it but its not what I >>>>>>>> really want. Rather than having just one column with all of the fields >>>>>>>> required to be filled out, how do I set it so its like 3-4 columns? >>>>>>>> >>>>>>>> For example: >>>>>>>> >>>>>>>> Name Address City State >>>>>>>> >>>>>>>> Instead of: >>>>>>>> >>>>>>>> Name >>>>>>>> Address >>>>>>>> City >>>>>>>> State >>>>>>>> >>>>>>>> Thanks. >>>>>>>> >>>>>>> -- >>>>>>> >>>>>>> --- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "we
Re: [web2py] Re: Change form layout
Thanks again for the info. I guess I still do not get it though if I set my formstyle to table3cols would'nt my form at least be laid out like: Name Address City State Or am I not looking at this correctly? On Mon, Jun 24, 2013 at 10:16 AM, Anthony wrote: > Your best bet is to look at how the built-in ones work, starting here: > https://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#752. Copy > the one of those that is closest to what you want and modify it as > necessary. > > def myformstyle(): > [custom code here] > > form = SQLFORM(..., formstyle=myformstyle) > > Anthony > > > On Monday, June 24, 2013 10:07:49 AM UTC-4, Tom Russell wrote: > >> Thanks for the responses. >> >> The formstyle looks interesting but I cannot make heads or tails out of >> the way to use it. Are there any examples of this some place? >> >> Thanks >> >> >> On Mon, Jun 24, 2013 at 9:55 AM, Anthony wrote: >> >>> I assume that means you are relying on a generic view to display your >>> table. If so, you can instead create a non-generic view (which you should >>> probably do anyway), or you can build the form DOM on the server using >>> web2py HTML helpers (probably not the way to go). The custom formstyle >>> option also does not require any HTML coding. >>> >>> Anthony >>> >>> >>> On Monday, June 24, 2013 9:35:31 AM UTC-4, Tom Russell wrote: >>> >>>> Thanks for the response. So now I am really confused because I have no >>>> idea where to put this code if I am using a SQLFORM.factory? >>>> >>>> Basically I just want to add row fluid to make the layout a little >>>> easier to navigate. I do not have a html file to set this code in for this >>>> form. >>>> >>>> Thanks. >>>> >>>> >>>> On Mon, Jun 24, 2013 at 9:04 AM, Anthony wrote: >>>> >>>>> http://web2py.com/books/**defaul**t/chapter/29/07#Custom-**forms<http://web2py.com/books/default/chapter/29/07#Custom-forms> >>>>> >>>>> I don't think it's in the book yet, but you can also create a custom >>>>> formstyle if you need to use the layout in multiple places: >>>>> https://groups.google.com/d/msg/web2py/QmoRmapiOwA/**t** >>>>> ZqeEbii6QgJ<https://groups.google.com/d/msg/web2py/QmoRmapiOwA/tZqeEbii6QgJ> >>>>> >>>>> Anthony >>>>> >>>>> >>>>> On Monday, June 24, 2013 8:53:16 AM UTC-4, Tom Russell wrote: >>>>>> >>>>>> I have a SQLForm and use the formset DIV for it but its not what I >>>>>> really want. Rather than having just one column with all of the fields >>>>>> required to be filled out, how do I set it so its like 3-4 columns? >>>>>> >>>>>> For example: >>>>>> >>>>>> Name Address City State >>>>>> >>>>>> Instead of: >>>>>> >>>>>> Name >>>>>> Address >>>>>> City >>>>>> State >>>>>> >>>>>> 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+un...@**googlegroups.com. >>>>> >>>>> For more options, visit >>>>> https://groups.google.com/**grou**ps/opt_out<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+un...@**googlegroups.com. >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<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. > > > -- --- 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: Change form layout
Thanks for the responses. The formstyle looks interesting but I cannot make heads or tails out of the way to use it. Are there any examples of this some place? Thanks On Mon, Jun 24, 2013 at 9:55 AM, Anthony wrote: > I assume that means you are relying on a generic view to display your > table. If so, you can instead create a non-generic view (which you should > probably do anyway), or you can build the form DOM on the server using > web2py HTML helpers (probably not the way to go). The custom formstyle > option also does not require any HTML coding. > > Anthony > > > On Monday, June 24, 2013 9:35:31 AM UTC-4, Tom Russell wrote: > >> Thanks for the response. So now I am really confused because I have no >> idea where to put this code if I am using a SQLFORM.factory? >> >> Basically I just want to add row fluid to make the layout a little easier >> to navigate. I do not have a html file to set this code in for this form. >> >> Thanks. >> >> >> On Mon, Jun 24, 2013 at 9:04 AM, Anthony wrote: >> >>> http://web2py.com/books/**default/chapter/29/07#Custom-**forms<http://web2py.com/books/default/chapter/29/07#Custom-forms> >>> >>> I don't think it's in the book yet, but you can also create a custom >>> formstyle if you need to use the layout in multiple places: >>> https://groups.google.**com/d/msg/web2py/QmoRmapiOwA/**tZqeEbii6QgJ<https://groups.google.com/d/msg/web2py/QmoRmapiOwA/tZqeEbii6QgJ> >>> >>> Anthony >>> >>> >>> On Monday, June 24, 2013 8:53:16 AM UTC-4, Tom Russell wrote: >>>> >>>> I have a SQLForm and use the formset DIV for it but its not what I >>>> really want. Rather than having just one column with all of the fields >>>> required to be filled out, how do I set it so its like 3-4 columns? >>>> >>>> For example: >>>> >>>> Name Address City State >>>> >>>> Instead of: >>>> >>>> Name >>>> Address >>>> City >>>> State >>>> >>>> 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+un...@**googlegroups.com. >>> >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<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. > > > -- --- 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: Change form layout
Thanks for the response. So now I am really confused because I have no idea where to put this code if I am using a SQLFORM.factory? Basically I just want to add row fluid to make the layout a little easier to navigate. I do not have a html file to set this code in for this form. Thanks. On Mon, Jun 24, 2013 at 9:04 AM, Anthony wrote: > http://web2py.com/books/default/chapter/29/07#Custom-forms > > I don't think it's in the book yet, but you can also create a custom > formstyle if you need to use the layout in multiple places: > https://groups.google.com/d/msg/web2py/QmoRmapiOwA/tZqeEbii6QgJ > > Anthony > > > On Monday, June 24, 2013 8:53:16 AM UTC-4, Tom Russell wrote: >> >> I have a SQLForm and use the formset DIV for it but its not what I really >> want. Rather than having just one column with all of the fields required to >> be filled out, how do I set it so its like 3-4 columns? >> >> For example: >> >> Name Address City State >> >> Instead of: >> >> Name >> Address >> City >> State >> >> 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] Change form layout
I have a SQLForm and use the formset DIV for it but its not what I really want. Rather than having just one column with all of the fields required to be filled out, how do I set it so its like 3-4 columns? For example: Name Address City State Instead of: Name Address City State 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.
Re: [web2py] Re: SmartGrid
aha that would be it. On Wed, Jun 19, 2013 at 5:26 PM, Niphlod wrote: > are you logged-in ? > For security reasons any modification to tables in grids is prevented on > anonymous access. > You can still give "write permissions" using user_signature=False, but > it's highly discouraged > > On Wednesday, June 19, 2013 5:25:58 PM UTC+2, t...@caregointl.com wrote: >> >> I have a smartgrid set up like this: >> >> def manage_patients(): >> grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, >> create=True, linked_tables=['**emergencycontacts','**dependents']) >> return dict(grid=grid) >> >> >> It displays fine but only has a view button to the far right. How do I >> have the add, edit and delete buttons as well? >> >> 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.
Re: [web2py] Re: 3 forms in 1
Yes I am using smartgrid elsewhere, very nice. I did do the 3 forms but used the factory to do it. Works nicely so far. On Tue, Jun 18, 2013 at 1:24 PM, villas wrote: > I don't believe you can use SQLFORM in that way, you'll have to create > your own form - maybe try SQLFORM.factory. Better still, try > SQLFORM.smartgrid which could allow you a very flexible way to manage all > three tables. > > > > On Tuesday, 18 June 2013 16:40:40 UTC+1, t...@caregointl.com wrote: >> >> I have one page where I want to show 3 forms. I have a main table with 2 >> tables that are related to it. >> >> So in my models file I have: >> >> db.define_table( >> 'dependents', >> Field('dep_id',db.patient), >> Field('first_name'), >> Field('middle_name'), >> Field('last_name'), >> Field('relationship', 'text')) >> >> db.define_table( >> 'emergencycontacts', >> Field('ec_id',db.patient), >> Field('first_name'), >> Field('middle_name'), >> Field('last_name'), >> Field('address1'), >> Field('address2'), >> Field('city'), >> Field('state'), >> Field('zipcode'), >> Field('country'), >> Field('phone'), >> Field('relationship')) >> >> And db.patient is another table. >> >> So in my form I have: >> >> def register_patient(): >> form=SQLFORM.factory(db.**patient,db.emergencycontacts, >> db.dependents) >> if form.process().accepted: >> id = db.patient.insert(**db.**patient._filter_fields(form.** >> vars)) >> form.vars.patient=id >> id = db.emergencycontacts.insert( >> db.emergencycontacts._filter_**fields(form.vars)) >> response.flash='Thanks for filling the form' >> id = db.dependents.insert(**db.**dependents._filter_fields(** >> form.vars)) >> form.vars.dependents=id >> # and get a list of all persons >> records = SQLTABLE(db().select(db.**patient.ALL),headers='** >> fieldname:capitalize') >> >> return dict(form=form, records=records) >> >> So the form displays correctly but I was expecting that the other fields >> for dependents and emergencycontacts would be there for input as well but I >> only get the id fields showing up for input. >> >> Am I doing what I want to do incorrectly? >> >> Thanks, >> >> Tom >> > -- > > --- > 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] 3 forms in 1
Yes I was just reading and understood that the reason for my fields not showing up was because the fields in many of the tables have the same names. Changing that resolved that issue. It's actually a great book too, just wished I could read faster. Thanks. On Tue, Jun 18, 2013 at 1:04 PM, Richard Vézina wrote: > I think you have 1 form for 3 tables... > > You should package a dummy app with the code above to help us helping > you... > > As far as I understand you got the id only because you didn't set requires > in your model. Read the book about validators and search for "requires" in > the book. > > Richard > > > On Tue, Jun 18, 2013 at 11:40 AM, wrote: > >> I have one page where I want to show 3 forms. I have a main table with 2 >> tables that are related to it. >> >> So in my models file I have: >> >> db.define_table( >> 'dependents', >> Field('dep_id',db.patient), >> Field('first_name'), >> Field('middle_name'), >> Field('last_name'), >> Field('relationship', 'text')) >> >> db.define_table( >> 'emergencycontacts', >> Field('ec_id',db.patient), >> Field('first_name'), >> Field('middle_name'), >> Field('last_name'), >> Field('address1'), >> Field('address2'), >> Field('city'), >> Field('state'), >> Field('zipcode'), >> Field('country'), >> Field('phone'), >> Field('relationship')) >> >> And db.patient is another table. >> >> So in my form I have: >> >> def register_patient(): >> form=SQLFORM.factory(db.patient,db.emergencycontacts, db.dependents) >> if form.process().accepted: >> id = db.patient.insert(**db.patient._filter_fields(form.vars)) >> form.vars.patient=id >> id = >> db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars)) >> response.flash='Thanks for filling the form' >> id = >> db.dependents.insert(**db.dependents._filter_fields(form.vars)) >> form.vars.dependents=id >> # and get a list of all persons >> records = >> SQLTABLE(db().select(db.patient.ALL),headers='fieldname:capitalize') >> >> return dict(form=form, records=records) >> >> So the form displays correctly but I was expecting that the other fields >> for dependents and emergencycontacts would be there for input as well but I >> only get the id fields showing up for input. >> >> Am I doing what I want to do incorrectly? >> >> Thanks, >> >> Tom >> >> -- >> >> --- >> 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. > > > -- --- 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.