[web2py] Re: Setting up the scheduler, and letting it run from a certain point of time

2016-02-26 Thread Lucas Schreiber
It finally worked. thank you very, very much for you patience and help. 
It took a while but thanks to you i finally understood how the scheduler 
works.

Thankyou one more time :)

Am Mittwoch, 24. Februar 2016 00:11:47 UTC+1 schrieb Lucas Schreiber:
>
> Hi there,
> while trying to understand how to use the scheduler, i found this post:
> https://groups.google.com/forum/#!topic/web2py/VCPZmSc0vLc
>
> In the Post, this code is writen:
> db.scheduler_task.insert(function_name='task1',
>  task_name='task1',
>  stop_time = now + timedelta(days=9),
>  repeats=0,
>  period=10)
> g
> Where do i put this code? in the model? I think this was partly answered 
> in the post, but i dont understand it. can someone explain this to me?
>
> Also, is there a way to let a scheduler run at a time writen in a db once 
> and then rest until the next time occurs? or is a permanent run every few 
> seconds checking for certain criteria the better solution?
>
> And just to see if I understood this so far correctly:
> the scheduler function is basically a function I write into the model, 
> offering everything a "normal" function offers, exectued at times i 
> determine?
>
> Kind regards 
> And
>

-- 
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: Setting up the scheduler, and letting it run from a certain point of time

2016-02-24 Thread Lucas Schreiber
I have read the book. But it doesn't state where to actually write the code 
snipes given. Both, the book and google is very fancy about explaining how 
to start a scheduler by the console. But i literally do not see how i can 
start the scheduler. 
If i write this into the controller, 

scheduler.queue_task(
task_1,
pargs=[],
pvars={},
start_time=now, #datetime
stop_time = None,   #datetime
timeout = 60,   #seconds
prevent_drift=False,
period=60,  #seconds
immediate=False,
repeats = 1
)

it atleast creates  the tables and populates one of the tables with an set 
of records(scheduler_task) and does so whenever i call the function. But it 
only works as long as the function is in the same controller. if the 
function is in the modules, an error is returned. When i put this into the 
model, it creates the tabels but does not populate any of them. 

some possible reasons why it does not run i have made up are:
-i'm queueing tasks but not creating a worker to work on them (but the book 
doesnt state anywhere to create a worker. I think therefore this cant be 
the solution)
-the function isn't defined proper and the worker does not know what to do.



Am Mittwoch, 24. Februar 2016 00:11:47 UTC+1 schrieb Lucas Schreiber:
>
> Hi there,
> while trying to understand how to use the scheduler, i found this post:
> https://groups.google.com/forum/#!topic/web2py/VCPZmSc0vLc
>
> In the Post, this code is writen:
> db.scheduler_task.insert(function_name='task1',
>  task_name='task1',
>  stop_time = now + timedelta(days=9),
>  repeats=0,
>  period=10)
> g
> Where do i put this code? in the model? I think this was partly answered 
> in the post, but i dont understand it. can someone explain this to me?
>
> Also, is there a way to let a scheduler run at a time writen in a db once 
> and then rest until the next time occurs? or is a permanent run every few 
> seconds checking for certain criteria the better solution?
>
> And just to see if I understood this so far correctly:
> the scheduler function is basically a function I write into the model, 
> offering everything a "normal" function offers, exectued at times i 
> determine?
>
> Kind regards 
> And
>

-- 
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: Setting up the scheduler, and letting it run from a certain point of time

2016-02-24 Thread Lucas Schreiber
Alright, so far i am able to create the tables, but nothing runs.

So far i have this:

Model:
database:
dba = DAL(connection)
dba.define_table('test_table',
Field('test_table_id', 'integer'),
Field('test_table_value'))

scheduler:

from gluon.scheduler import Scheduler
scheduler = Scheduler(dba)



controller:
index:

def start():
import datetime
daytime_start = datetime.datetime(2017, 1, 1, 0, 0)
a = 'a'
dba.scheduler_task.insert(function_name='task_1',
 task_name='task_1',
 stop_time = daytime_start,
 repeats=0,
 period=10)

return dict(a=a)
def index():
text1 = 'test'
return dict (text1=text1)


module:

test.py:
def task_1():
c= 0
dba.test_table.insert(test_table_id = 1, test_table_value = 'a')
db.commit()
return dict(c=c)

How do i get it startet, e.g. filling the test_table with those values 
every n seconds?

Thank you very much for your help so far



Am Mittwoch, 24. Februar 2016 00:11:47 UTC+1 schrieb Lucas Schreiber:
>
> Hi there,
> while trying to understand how to use the scheduler, i found this post:
> https://groups.google.com/forum/#!topic/web2py/VCPZmSc0vLc
>
> In the Post, this code is writen:
> db.scheduler_task.insert(function_name='task1',
>  task_name='task1',
>  stop_time = now + timedelta(days=9),
>  repeats=0,
>  period=10)
> g
> Where do i put this code? in the model? I think this was partly answered 
> in the post, but i dont understand it. can someone explain this to me?
>
> Also, is there a way to let a scheduler run at a time writen in a db once 
> and then rest until the next time occurs? or is a permanent run every few 
> seconds checking for certain criteria the better solution?
>
> And just to see if I understood this so far correctly:
> the scheduler function is basically a function I write into the model, 
> offering everything a "normal" function offers, exectued at times i 
> determine?
>
> Kind regards 
> And
>

-- 
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] Setting up the scheduler, and letting it run from a certain point of time

2016-02-23 Thread Lucas Schreiber
Hi there,
while trying to understand how to use the scheduler, i found this post:
https://groups.google.com/forum/#!topic/web2py/VCPZmSc0vLc

In the Post, this code is writen:
db.scheduler_task.insert(function_name='task1',
 task_name='task1',
 stop_time = now + timedelta(days=9),
 repeats=0,
 period=10)
g
Where do i put this code? in the model? I think this was partly answered in 
the post, but i dont understand it. can someone explain this to me?

Also, is there a way to let a scheduler run at a time writen in a db once 
and then rest until the next time occurs? or is a permanent run every few 
seconds checking for certain criteria the better solution?

And just to see if I understood this so far correctly:
the scheduler function is basically a function I write into the model, 
offering everything a "normal" function offers, exectued at times i 
determine?

Kind regards 
And

-- 
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: List in a db Request

2016-02-20 Thread Lucas Schreiber
Yeah, this works perfectly. Thank you very much :)

Am Freitag, 19. Februar 2016 20:39:42 UTC+1 schrieb Niphlod:
>
> dba(~dba.table.name.belongs(list)).select()
>
> On Friday, February 19, 2016 at 7:50:13 PM UTC+1, Lucas Schreiber wrote:
>>
>> Hi there,
>>
>> is there a way to use a list in a db request? like this:
>> list = [One, Two, Three]
>>
>> row_db = dba((dba.table.table_name!= list)).select()
>>
>>
>> and getting every row, which doesnt have one of the emelents as a name?
>>
>>
>> Thank you
>>
>>

-- 
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] List in a db Request

2016-02-19 Thread Lucas Schreiber
Hi there,

is there a way to use a list in a db request? like this:
list = [One, Two, Three]

row_db = dba((dba.table.table_name!= list)).select()


and getting every row, which doesnt have one of the emelents as a name?


Thank you

-- 
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] SQLFORM changing the column of record

2016-01-28 Thread Lucas Schreiber
Hi,
ist there a way to change the column of the record in an SQLFORM?

For example, my code looks like this:

module
dba.define_table('test_table',
Field('field_1', 'integer'),
Field('field_2', 'integer'))

controller

def index():

record = 1

form=SQLFORM(dba.test_table, record, submit_button='test')

return dict (b=form)



When i understand it correctly, the record matches the autocreated id Field of 
the table, is there a way to match it with the field_1, for example?


Thank you


-- 
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: saving multiple forms in a dict and giving them out in the view

2016-01-25 Thread Lucas Schreiber
Thank you for your advise,

You a correct, the return is wrong. Sorry about that. 
Isn't "item" a method of dict?
when i try to name every form different, by saving them in a list, i get a 
'list assigment index out of range'
without saving them in a list and naming evry form the same, no error 
occurs, but my result looks like this:
{1: },  1: {1: },  2: {1: }}

i marked the changes i made in red:

controller:

def test():

names_in db = db(db.names.group_2 == group).count()
names_in db_row = db(db.names.group_2 == group).select(dba.names.ALL)
i = 0
names_in db_dict = {}

new_dict_element = []

form = []
while i < names_in db:

form[i] = FORM('',

INPUT(_name='name', _value=i, requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))

current_name =names_in db_row[i].group_2

new_dict_element.append[current_name] 

new_dict_element.append[form[i]]
names_in db_dict[i] = new_dict_element[]
i = i+1

if form[i].process().accepted: #Now 
part of the while function

   remove_id = form.vars.name

  return dict (names_in_db = names_in_db_dict) 



view:


{{=names_in_db_dict}}   
#without the for function


Am Sonntag, 24. Januar 2016 19:08:48 UTC+1 schrieb Lucas Schreiber:
>
> Hey, 
> i would like to save some values in a dict and give them out together with 
> a form. it should look something like this:
> ([] marks a button, the name n are the values, and links)
>
> name1   [Remove?]
> name2   [Remove?]
> name3   [Remove?]
> .
> .
> .
> name n [Remove?]
>
>
> my idea looks like this:
>
> [code]
> controller:
>
> def test():
>
> names_in db = db(db.names.group_2 == group).count()
> names_in db_row = db(db.names.group_2 == group).select(dba.names.ALL)
> i = 0
> names_in db_dict = {}
>
> new_dict_element = []
> while i < names_in db:
>
> form = FORM('',
>
> INPUT(_name='name', _value=i, requires=IS_NOT_EMPTY()),
> INPUT(_type='submit'))
>
> current_name =names_in db_row[i].group_2
>
> new_dict_element.append[current_name] 
>
> new_dict_element.append[form]
> names_in db_dict[i] = new_dict_element[]
> i = i+1
>
> if form.process().accepted:
>
>remove_id = form.vars.name
>
>   return dict (names_in_db = names_in_db) 
>
>
>
> view:
>
>
> {{=for item in names_in_db}}{{=item}}
>
>
> [/code]
>
>
> is dict the proper type for this? why isn't it working?
>
> thank you alot guys :)
>
>

-- 
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] saving multiple forms in a dict and giving them out in the view

2016-01-24 Thread Lucas Schreiber
Hey, 
i would like to save some values in a dict and give them out together with 
a form. it should look something like this:
([] marks a button, the name n are the values, and links)

name1   [Remove?]
name2   [Remove?]
name3   [Remove?]
.
.
.
name n [Remove?]


my idea looks like this:

[code]
controller:

def test():

names_in db = db(db.names.group_2 == group).count()
names_in db_row = db(db.names.group_2 == group).select(dba.names.ALL)
i = 0
names_in db_dict = {}

new_dict_element = []
while i < names_in db:

form = FORM('',

INPUT(_name='name', _value=i, requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))

current_name =names_in db_row[i].group_2

new_dict_element.append[current_name] 

new_dict_element.append[form]
names_in db_dict[i] = new_dict_element[]
i = i+1

if form.process().accepted:

   remove_id = form.vars.name

  return dict (names_in_db = names_in_db) 



view:


{{=for item in names_in_db}}{{=item}}


[/code]


is dict the proper type for this? why isn't it working?

thank you alot guys :)

-- 
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: multiple forms created by for in:

2014-05-23 Thread Lucas Schreiber
Alright, now i understand. Thats a pretty good structur, thank you very 
much :)

Am Donnerstag, 22. Mai 2014 13:12:19 UTC+2 schrieb Lucas Schreiber:
>
> Hey,
> i'm sorry, i need help again :)
> i have a db table, and i want to create a üage where for every row is a 
> form. my idea looks like this:
>
> row_db = dba(dba.user.user_id == user_id).select(dba.user.ALL)
> for row in row_db:
> form=FORM('Your name:',
>SELECT(),
>INPUT(_type='submit', _value = 'HERE'))
> if form.process(formname='form_one').accepted:
>
> but it does not work since every time the form variable gets replaced. Has 
> anyone an idea? maybe it is possible to create something like this?
> form_'a'=FORM('Your name:',...
> and 'a' changes with every loop? but i don't think it'll work like that.
> Does anyone has an idea?
>

-- 
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: multiple forms created by for in:

2014-05-22 Thread Lucas Schreiber
but how can i create a list of forms?
this code does not work since form is a string ( or, at least, no int, 
double float,...)



for row in row_db:
form_element=FORM('Your name:',
   SELECT(),
   INPUT(_type='submit', _value = 'HERE'))
form.append(form_element)


Am Donnerstag, 22. Mai 2014 13:12:19 UTC+2 schrieb Lucas Schreiber:

> Hey,
> i'm sorry, i need help again :)
> i have a db table, and i want to create a üage where for every row is a 
> form. my idea looks like this:
>
> row_db = dba(dba.user.user_id == user_id).select(dba.user.ALL)
> for row in row_db:
> form=FORM('Your name:',
>SELECT(),
>INPUT(_type='submit', _value = 'HERE'))
> if form.process(formname='form_one').accepted:
>
> but it does not work since every time the form variable gets replaced. Has 
> anyone an idea? maybe it is possible to create something like this?
> form_'a'=FORM('Your name:',...
> and 'a' changes with every loop? but i don't think it'll work like that.
> Does anyone has an idea?
>

-- 
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] multiple forms created by for in:

2014-05-22 Thread Lucas Schreiber
Hey,
i'm sorry, i need help again :)
i have a db table, and i want to create a üage where for every row is a 
form. my idea looks like this:

row_db = dba(dba.user.user_id == user_id).select(dba.user.ALL)
for row in row_db:
form=FORM('Your name:',
   SELECT(),
   INPUT(_type='submit', _value = 'HERE'))
if form.process(formname='form_one').accepted:

but it does not work since every time the form variable gets replaced. Has 
anyone an idea? maybe it is possible to create something like this?
form_'a'=FORM('Your name:',...
and 'a' changes with every loop? but i don't think it'll work like that.
Does anyone has an idea?

-- 
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: creating a row3 where the rows are in row1 but not in row2

2014-05-19 Thread Lucas Schreiber
Thank you very much, Anthony. Your code almost works, it needed just a 
minor correction:

owned_licenses = dba(dba.owned_license.owner_id == owner_id)._select(dba.
owned_license.license_id, distinct=True)
unowned_licenses = dba(~dba.license.license_id.belongs(owned_licenses)).
select()

Then it works fine. Thanks 

Am Sonntag, 18. Mai 2014 15:34:28 UTC+2 schrieb Lucas Schreiber:

> Hey,
> i have another Problem. Imagine you have two rows created as follow:
>
> models:
>
>
> dba.define_table('owned_license',
> Field('owner_id', 'integer'),
> Field('license_id', 'integer'))
>
>
> dba.define_table('license',
> Field('license_name', 'integer'),
> Field('license_id', 'integer'))
>
>
> Controller:
>
> owned_license_db = dba(dba.owned_license.owner_id== owner_id).select(dba.
> owned_license.ALL)
> license_db = dba().select(dba.license.ALL)
>
>
> Inserts in the db (for example):
>
> dba.license.insert(license_id= 1, license_name= 'test1')
> dba.license.insert(license_id= 2, license_name= 'test2')
> dba.license.insert(license_id= 3, license_name= 'test3')
> dba.license.insert(license_id= 4, license_name= 'test4')
> dba.license.insert(license_id= 5, license_name= 'test5')
>
>
> dba.owned_license.insert(owner_id = 1, license_id= 2)
> dba.owned_license.insert(owner_id = 1, license_id= 3)
> dba.owned_license.insert(owner_id = 1, license_id= 4)
> dba.owned_license.insert(owner_id = 2, license_id= 1)
> dba.owned_license.insert(owner_id = 2, license_id= 3)
>
>
>
>
> in this example, if i have owner_id =1, i want a row with every row from 
> license_db not in owned_license_db, so, in this example, 1 and 5.
>
> How can this be done?
>
> Thanks for every help :)
>

-- 
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] creating a row3 where the rows are in row1 but not in row2

2014-05-18 Thread Lucas Schreiber
Hey,
i have another Problem. Imagine you have two rows created as follow:

models:


dba.define_table('owned_license',
Field('owner_id', 'integer'),
Field('license_id', 'integer'))


dba.define_table('license',
Field('license_name', 'integer'),
Field('license_id', 'integer'))


Controller:

owned_license_db = dba(dba.owned_license.owner_id== owner_id).select(dba.
owned_license.ALL)
license_db = dba().select(dba.license.ALL)


Inserts in the db (for example):

dba.license.insert(license_id= 1, license_name= 'test1')
dba.license.insert(license_id= 2, license_name= 'test2')
dba.license.insert(license_id= 3, license_name= 'test3')
dba.license.insert(license_id= 4, license_name= 'test4')
dba.license.insert(license_id= 5, license_name= 'test5')


dba.owned_license.insert(owner_id = 1, license_id= 2)
dba.owned_license.insert(owner_id = 1, license_id= 3)
dba.owned_license.insert(owner_id = 1, license_id= 4)
dba.owned_license.insert(owner_id = 2, license_id= 1)
dba.owned_license.insert(owner_id = 2, license_id= 3)




in this example, if i have owner_id =1, i want a row with every row from 
license_db not in owned_license_db, so, in this example, 1 and 5.

How can this be done?

Thanks for every help :)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: form element select add options

2014-05-14 Thread Lucas Schreiber
Thanks, that's exactly what I was looking for :)

Am Montag, 12. Mai 2014 23:58:04 UTC+2 schrieb Trend Codax:
>
>  Hey guys, 
> I have a form, a SQL Form. I'm adding an element, a select element. But 
> how can i add Options to this element?
>
>
>  form = SQLFORM(dba.account_directory)
> my_extra_element = TR(LABEL('Country'), SELECT(_name='country'))
> form[0].insert(-1,my_extra_element)
>
>
> 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: Form + combined

2014-04-19 Thread Lucas Schreiber
Uhm, while working, i noticed your code does not really have all features i 
tried to implent, i'm sorry.


Am Donnerstag, 17. April 2014 15:35:11 UTC+2 schrieb Lucas Schreiber:

> hey,
> i have a Problem and i don't know how to solve it. I want a form with an 
> Input "text" field ( let's call it "amount') and an   part 
> (let's call it 'area'). And, finally, a "submit" button. All this shall 
> work as follow:
>
> The Options of 'Area' should not only limited by everything in 
> 'area_value', but also by another variable, the db.area.area_name == 1 
> for example. In the Cookies for example the is a variable transfered and 
> now you can only choose from 'area_value' listed in the db and with a 
> matching 'name' 
>
 I guess the model should look like this:
>
 
> db.define_table('area',
>Field('area_value', 'string',
>notnull=True,
>required=True,
>requires=IS_NOT_EMPTY(),
>),
>
   Field('area_name', 'string')
>migrate=True,
>format='%(area_value)s'
>)
>
>
>)
> But now it still Needs to be filtered. I'm sorry i this wasn't clear 
> enough at the beginning, sorry 
>

> You enter a number in "amount", choose an "area" and press "submit". Once 
> done, an db table records your "amount" and "area". 
>
> But the Options of the "area" are depending on a db table, giving out like 
> for example 5 records, 
> area_db = db(db.area.area_value == 1).select(db.area.ALL)
>
>
>
> 
> {{x=0}}
> {{y=0}}
> {{for row in area_db:}} 
> {{r = area_db[y].area_value
>   t = area_db[y].area_name
>  y = y+1
>  x= x+1}}{{=t}}{{pass}}
> 
>
>
>
> How can i Combine it with an form, so i can enter an amount and submit 
> this for further use?
> Thanks, 
> Regards
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Form + combined

2014-04-18 Thread Lucas Schreiber
Thanks :)

Am Donnerstag, 17. April 2014 15:35:11 UTC+2 schrieb Lucas Schreiber:
>
> hey,
> i have a Problem and i don't know how to solve it. I want a form with an 
> Input "text" field ( let's call it "amount') and an   part 
> (let's call it 'area'). And, finally, a "submit" button. All this shall 
> work as follow:
>
>
>
> You enter a number in "amount", choose an "area" and press "submit". Once 
> done, an db table records your "amount" and "area". 
>
> But the Options of the "area" are depending on a db table, giving out like 
> for example 5 records, 
> area_db = db(db.area.area_value == 1).select(db.area.ALL)
>
>
>
> 
> {{x=0}}
> {{y=0}}
> {{for row in area_db:}} 
> {{r = area_db[y].area_value
>   t = area_db[y].area_name
>  y = y+1
>  x= x+1}}{{=t}}{{pass}}
> 
>
>
>
> How can i Combine it with an form, so i can enter an amount and submit 
> this for further use?
> Thanks, 
> Regards
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Form + combined

2014-04-18 Thread Lucas Schreiber
*push*
still no idea

Am Donnerstag, 17. April 2014 15:35:11 UTC+2 schrieb Lucas Schreiber:

> hey,
> i have a Problem and i don't know how to solve it. I want a form with an 
> Input "text" field ( let's call it "amount') and an   part 
> (let's call it 'area'). And, finally, a "submit" button. All this shall 
> work as follow:
>
>
>
> You enter a number in "amount", choose an "area" and press "submit". Once 
> done, an db table records your "amount" and "area". 
>
> But the Options of the "area" are depending on a db table, giving out like 
> for example 5 records, 
> area_db = db(db.area.area_value == 1).select(db.area.ALL)
>
>
>
> 
> {{x=0}}
> {{y=0}}
> {{for row in area_db:}} 
> {{r = area_db[y].area_value
>   t = area_db[y].area_name
>  y = y+1
>  x= x+1}}{{=t}}{{pass}}
> 
>
>
>
> How can i Combine it with an form, so i can enter an amount and submit 
> this for further use?
> Thanks, 
> Regards
>

-- 
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 + combined

2014-04-17 Thread Lucas Schreiber
hey,
i have a Problem and i don't know how to solve it. I want a form with an 
Input "text" field ( let's call it "amount') and an   part 
(let's call it 'area'). And, finally, a "submit" button. All this shall 
work as follow:

You enter a number in "amount", choose an "area" and press "submit". Once 
done, an db table records your "amount" and "area". 

But the Options of the "area" are depending on a db table, giving out like 
for example 5 records, 
[code]
area_db = db(db.area.area_value == 1).select(db.area.ALL)
[/code]
[code]

{{x=0}}
{{y=0}}
{{for row in area_db:}} 
{{r = area_db[y].area_value
  t = area_db[y].area_name
 y = y+1
 x= x+1}}{{=t}}{{pass}}
[/code]

How can i Combine it with an form, so i can enter an amount and submit this 
for further use?
Thanks, 
Regards

-- 
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: Variables from url

2014-01-25 Thread Lucas Schreiber
Thanks :)
It is exactly what i needed :)

-- 
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/groups/opt_out.


[web2py] Variables from url

2014-01-24 Thread Lucas Schreiber
Hi,
I have a question:

For example, somebody opens this page:
.../profile/1

Now, in the def profile(): there shall be a variable:

a=1

Or, when this page gets opened:
.../profile/12345

I wish this variable:
a=12345

Is it possible to do this in web2py?
Can you explain me how?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Form input prolem

2014-01-22 Thread Lucas Schreiber
Hi, i thought the form worked good, but unfortunally i was wrong.
name = form.vars.name contains the data from 'Name', INPUT(_name='name'),
but
passwords = form.vars.password is always none

here again the code, with the improvements:

def login():
form = FORM(
'Name', INPUT(_name='name'),
'password', INPUT(_password='password'),
INPUT(_type='submit'))
if form.process().accepted:
name = form.vars.name
passwdb = dba(dba.user.name== name).select(dba.user.password).first
()
passwords = form.vars.password
dba.user.insert(name = 'justtest', password= form.vars.name, email=form
.vars.password, country= form.vars.name)
if passwdb == passwords:
   redirect(URL('index'))
else:
   redirect(URL('register'))
   
return dict(form=form)


Am Sonntag, 19. Januar 2014 19:28:23 UTC+1 schrieb Lucas Schreiber:
>
> Hi guys,
>
> i have this function:
>
> def login():
> form = FORM(
> 'Name', INPUT(_name='name'),
> 'password', INPUT(_password='password'), 
> INPUT(_type='submit'))
> if form.process().accepted:
> name = form.vars.name
> records = SQLTABLE(dba(dba.user.name== name).select(dba.user.
> password),headers='fieldname:capitalize')
> passworddb = records[1]
> password = form.vars.password
> dba.person.insert(name = 'test', email=password)
> if passworddb == password:
>redirect(URL('register'))
> else:
>redirect(URL('index'))
> 
> return dict(form=form)
>
>
> As you can see, you enter name and password into a form, and from a db it 
> choose a password correspondending to the username. that part works fine. 
> but the problem is on the part:
>
> password = form.vars.password
>
> i think this doesnt work, since the line below
>
>
> dba.person.insert(name = 'test', email=password)
>
> inserts into another db "test", "none"
>
> Do anyone has an idea how to fix this problem? Or can anyone tell me what 
> i did wrong?
>
> Thanks for the help,
> Darren
>

-- 
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/groups/opt_out.


[web2py] Re: Form input prolem

2014-01-20 Thread Lucas Schreiber
sure.

So, there is a form where you enter a Password and a username. 
now, the function shall take the username and check if there is any 
username like that in the db. if there is such a username, the 
correspondending Password shall be read and seperated into a variable. now, 
if the Password from the db fetch the Password from the form, the function 
Redirects to one page, else to another ( as you can see, this is just a 
very basic function, and not ready)

hope, now it got more clear :)

Am Sonntag, 19. Januar 2014 19:28:23 UTC+1 schrieb Lucas Schreiber:

> Hi guys,
>
> i have this function:
>
> def login():
> form = FORM(
> 'Name', INPUT(_name='name'),
> 'password', INPUT(_password='password'), 
> INPUT(_type='submit'))
> if form.process().accepted:
> name = form.vars.name
> records = SQLTABLE(dba(dba.user.name== name).select(dba.user.
> password),headers='fieldname:capitalize')
> passworddb = records[1]
> password = form.vars.password
> dba.person.insert(name = 'test', email=password)
> if passworddb == password:
>redirect(URL('register'))
> else:
>redirect(URL('index'))
> 
> return dict(form=form)
>
>
> As you can see, you enter name and password into a form, and from a db it 
> choose a password correspondending to the username. that part works fine. 
> but the problem is on the part:
>
> password = form.vars.password
>
> i think this doesnt work, since the line below
>
>
> dba.person.insert(name = 'test', email=password)
>
> inserts into another db "test", "none"
>
> Do anyone has an idea how to fix this problem? Or can anyone tell me what 
> i did wrong?
>
> Thanks for the help,
> Darren
>

-- 
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/groups/opt_out.


[web2py] Form input prolem

2014-01-19 Thread lucas . schreiber . privat
Hi guys,

i have this function:

def login():
form = FORM(
'Name', INPUT(_name='name'),
'password', INPUT(_password='password'), 
INPUT(_type='submit'))
if form.process().accepted:
name = form.vars.name
records = SQLTABLE(dba(dba.user.name== name).select(dba.user.
password),headers='fieldname:capitalize')
passworddb = records[1]
password = form.vars.password
dba.person.insert(name = 'test', email=password)
if passworddb == password:
   redirect(URL('register'))
else:
   redirect(URL('index'))

return dict(form=form)


As you can see, you enter name and password into a form, and from a db it 
choose a password correspondending to the username. that part works fine. 
but the problem is on the part:

password = form.vars.password

i think this doesnt work, since the line below


dba.person.insert(name = 'test', email=password)

inserts into another db "test", "none"

Do anyone has an idea how to fix this problem? Or can anyone tell me what i 
did wrong?

Thanks for the help,
Darren

-- 
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/groups/opt_out.