[web2py] Re: Web2py uploads and downloads

2013-07-02 Thread Domagoj Kovač
For the moment i will leave this upload with DAL, in the future i will make upload class. I still have a problem with this: def nt_download(): return response.stream(open(os.path.join(request.folder, 'uploads', request.args(0))), attachment=True) This code doesn't work properly for files like

[web2py] Re: Web2py uploads and downloads

2013-07-01 Thread Domagoj Kovač
Is there any way that i can control this generated filename? For example my filenames can be some sort of hash from current timestamp. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emai

[web2py] Re: Web2py uploads and downloads

2013-07-01 Thread Domagoj Kovač
Yes. i am running windows. Can anyone explain how web2py creates does filenames? -- --- 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...@google

[web2py] Re: Web2py uploads and downloads

2013-07-01 Thread Domagoj Kovač
I also noticed one more thing, looks like web2py brakes when i try to upload file with extralong filename. If i try to upload a file with name "extra long filename, 123 dsadsa dsadsadsadsa, dsadsadsa3r 342 432432342, 43232.txt" i receive an error: [Errno 2] No such file or directory: 'C:\\deve

[web2py] Web2py uploads and downloads

2013-07-01 Thread Domagoj Kovač
Hi, I have a problem. I created multiple files upload like this: if "attachments" in request.vars: attachments = request.vars.attachments if type(attachments) is list: for attachment in attachments: Attachment.

[web2py] Storing attachments

2013-06-26 Thread Domagoj Kovač
Hi, I have a question: if request.env.request_method == "POST": attachments = request.vars.attachments if len(attachments) > 0: for attachment in attachments: image = db.entry_value.upload_value.store(attachment. file, attachment.

Re: [web2py] Multiple files upload

2013-06-26 Thread Domagoj Kovač
I have one more question, is it possible to disable this uploading feature? I thought i can add attachment field manually in my form, not trought SQLFORM.factory, but if i add this field manually, i still get an error. This basically means that if i want to have multiple uploads the way i imagi

Re: [web2py] Multiple files upload

2013-06-26 Thread Domagoj Kovač
SQLFORM facilities for this expecting it > to work. > > AFAIK cgi.FieldStorage can't process out of the box HTML5's multiple input > files. > > On Wednesday, June 26, 2013 12:24:17 PM UTC+2, Domagoj Kovač wrote: >> >> Hi Niphlod, >> >> I

Re: [web2py] Multiple files upload

2013-06-26 Thread Domagoj Kovač
Hi Niphlod, I reviewed your code, in your test method you have: form = SQLFORM.factory( Field('an_integer', 'integer'), Field('upload_1', 'upload', uploadfolder=upf), Field('upload_2', 'upload', uploadfolder=upf), table_name='an_entry' ) i don't want two f

[web2py] Re: pymongo

2013-06-18 Thread Domagoj Kovač
I re-installed python, it works now. Looks like i did not configure everything properly. Massimo thanks for fast reply's. -- --- 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, se

[web2py] Re: pymongo

2013-06-18 Thread Domagoj Kovač
Yes it is installed. Python version 2.7. I can import from normal Python shell. Web2py version 2.4.5. -- --- 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 web2

[web2py] pymongo

2013-06-18 Thread Domagoj Kovač
Hi, i would like to use mongoDB directly without DAL. I added this to the bottom of my model/0.py # connect to mongoDB connection = pymongo.MongoClient('localhost', 27017) # attach to test database mongo = connection.asset - this gives me an error name 'pymongo' is not defined if i add impor

Re: [web2py] Multiple files upload

2013-06-14 Thread Domagoj Kovač
This is really important to me, can anyone help me? -- --- 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,

Re: [web2py] Multiple files upload

2013-06-14 Thread Domagoj Kovač
Yes i searched there also, but i did not find anything that fits my needs. All uploads work the same way, there is no multiple upload. Files are sent to server one by one. I want to upload the files directly, not with some jquery combination. -- --- You received this message because you are

Re: [web2py] Multiple files upload

2013-06-13 Thread Domagoj Kovač
Does anyone have any advice on this topic? I really must be able to do this somehow. I think the problem happens in form.validate() function, because web2py is trying to validate everything and in there he is trying to save the file. I see two options: 1. Somehow disable web2py automatic fi

Re: [web2py] Multiple files upload

2013-06-13 Thread Domagoj Kovač
I have a problem once again :). I have a code: for entry_class_attribute in entry_class_attributes: if entry_class_attribute.entry_label: entry_label = entry_class_attribute.entry_attribute_id.name fields.append(EntryValue.get_field(entry_class_attri

Re: [web2py] Multiple files upload

2013-06-13 Thread Domagoj Kovač
Thanks Niplod, looks like i must handle this on my own. It would be great if web2py could do this out of the box. -- --- 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 em

Re: [web2py] Multiple files upload

2013-06-12 Thread Domagoj Kovač
I have a filed: field = Field(field_name, "upload", requires=IS_NOT_EMPTY(), uploadfolder=os.path.join(request.folder , 'uploads'), label=LABEL(field_description, _for= input

[web2py] Multiple files upload

2013-06-12 Thread Domagoj Kovač
Hi, I have a question. I want to enable multiple files upload. I will not be using any jQuery/ajax script. I am using HTML5 multiple attribute on my input field, and then. Html 5 File API just for displaying files below my form. $(".upload").change(function(evt) { var button = $(th

[web2py] Re: Default template file

2013-06-12 Thread Domagoj Kovač
Yes i see it now, i totally forgot about that :). -- --- 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, vi

[web2py] Default template file

2013-06-12 Thread Domagoj Kovač
Hi, I have a question. Currently there is a file views/layout.html, default view is possible to change with response.view = 'shared/entry_value_grid.html' is it possible to change default template view? -- --- You received this message because you are subscribed to the Google Groups "web2p

[web2py] Re: Multitenancy

2013-06-10 Thread Domagoj Kovač
I found the solution to my problem but i still dont understand why this doesnt workd like it should. Line: rows = db().select(db.country.ALL, limitby=limit_by) Must be: rows = db(db.country.id > 0).select(db.country.ALL, limitby=limit_by) And then request_teneant = 3 is added as a condition giv

[web2py] Multitenancy

2013-06-10 Thread Domagoj Kovač
Hi, I have multitenancy application, in my application i have a table called countries where i have fields: id name alpha_2_code alpha_3_code numeric_code request_tenant My loged user has request tenant value of 3 but in my log i see query without this condition: SELECT country.id, country.name

[web2py] Re: in a view

2013-06-04 Thread Domagoj Kovač
This works. Thanks On Monday, June 3, 2013 5:14:37 PM UTC+2, villas wrote: > > Try this: > > {{cell_value = XML("".join(map(str, cell_value)))}} > > > > > On Monday, 3 June 2013 16:03:01 UTC+1, Domagoj Kovač wrote: >> >> Hi, >> >> I

[web2py] in a view

2013-06-03 Thread Domagoj Kovač
Hi, I have a code like this: {{for row in table:}} {{for report_attribute in report_attributes:}} {{cell_value = table[row][report_attribute.report_attribute.id]["cell_value"]}} {{

[web2py] request.get_vars

2013-05-23 Thread Domagoj Kovač
{{export_get_vars = request.get_vars}} {{export_get_vars.export_format = "csv"}} {{export_get_vars.export_format = "xls"}} {{=request.get_vars}} I have a code like this, i dont understand what is going on. I assign request.get_vars to export_get_vars, when i add seomething to expo

[web2py] Re: System logout

2013-05-22 Thread Domagoj Kovač
Thanks Anthony now i understand what is going on. In my 0.py i added: if session.company_url: auth.settings.login_url = URL("default", "login", args=session. company_url) else: auth.settings.login_url = URL("default", "login") session.company_url is set on login. This works like i wanted.

[web2py] Re: System logout

2013-05-22 Thread Domagoj Kovač
Looking at my function and your replies i can set: auth.settings.logout_next = URL("default", "login", "company") and this should redirect the user after he is logged out automatically. But this doesn't happen. Althought something like this should work i don't want to do it that way, i want to se

[web2py] Re: System logout

2013-05-22 Thread Domagoj Kovač
I want to set the location of my logout function. I have my own logout function: def logout(): if 'url_suffix' in request.cookies: url_suffix = request.cookies['url_suffix'].value response.cookies['url_suffix'] = "" response.cookies['url_suffix']['expires'] = -1000

[web2py] Re: System logout

2013-05-22 Thread Domagoj Kovač
You misunderstood me :D, of course it is not possible to do anything on users computer, that would be scary :), although as a developer i would like it :). I did not mean system logout like user system logout i thought system logout like framework logout function, here system refers to my appl

[web2py] Re: System logout

2013-05-22 Thread Domagoj Kovač
auth.settings.logged_url = URL("default", "logout") I see now that this line is not what i thought it was. For some reason i thought this line is actual system logout function. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscri

[web2py] System logout

2013-05-22 Thread Domagoj Kovač
Hi, I have multi tenant application where i have two logins. One login is only for super user and can be found on mydomain.com/login. Other login is for regular users and can be found on mydomain.com/company/login or mydomain/company2/login. I have my own login and logout function, my login fu

[web2py] CSV special characters

2013-05-17 Thread Domagoj Kovač
Hi, I am working on CSV export. I have a function that returns a string. output_string = StringIO.StringIO() csv_writer = csv.writer(output_string, delimiter=';', quotechar=' ',quoting =csv.QUOTE_MINIMAL) csv_writer.writerows(output) contents = output_string.get

Re: [web2py] Re: Helper classes

2013-05-16 Thread Domagoj Kovač
I like add_method :). Thanks 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:/

[web2py] Re: Helper classes

2013-05-16 Thread Domagoj Kovač
Anthony thanks. Previously i worked with various languages and frameworks and my general practice was to use models only for things related to data model. Here i am not sure for what models are intended, firstly i used them for create_table definitions, but as my code grew i moved this definitio

[web2py] Re: Helper classes

2013-05-16 Thread Domagoj Kovač
sociated models? On Thursday, May 16, 2013 3:40:06 PM UTC+2, Anthony wrote: > > You could put them in a model file, which will make them available > everywhere on every request, or you can put them in a module and import > them when needed. > > Anthony > > On Thursday,

[web2py] Helper classes

2013-05-16 Thread Domagoj Kovač
Hi, i have bunch of functions that i would like to extract to helper classes. Where should i put this helpers and how to include them? -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving email

[web2py] Self reference select

2013-05-15 Thread Domagoj Kovač
Hi, i have a table of locations: db.define_table('entry_location', Field('name', 'string', required=True, requires=IS_NOT_EMPTY(), label=LABEL(T("Naziv"), _for="entry_location_name")), Field('parent_id', '

[web2py] Re: IS IN DB

2013-05-08 Thread Domagoj Kovač
ng a join) and use IS_IN_SET() instead. > > Anthony > > On Wednesday, May 8, 2013 8:41:32 AM UTC-4, Domagoj Kovač wrote: >> >> This gives: >> >> 'Row' object has no attribute >> 'entry_attribute' >> On Wednesday, May 8, 2013 2:37:54 P

[web2py] Re: IS IN DB

2013-05-08 Thread Domagoj Kovač
This gives: 'Row' object has no attribute 'entry_attribute' On Wednesday, May 8, 2013 2:37:54 PM UTC+2, Anthony wrote: > > > requires=IS_IN_DB(db(db.report_attribute.entry_attribute_id == db. >> entry_attribute.id), "report_attribute.id", '%(entry_attribute.name)s',zero >> =T("-- Odaberite --"))

Re: [web2py] IS IN DB

2013-05-08 Thread Domagoj Kovač
db.define_table("entry_attribute", Field('name', 'string', required=True, requires=[IS_NOT_EMPTY(), IS_ALPHANUMERIC()], label=LABEL(T("Naziv"), _for="entry_attribute_type")),

[web2py] Re: IS IN DB

2013-05-08 Thread Domagoj Kovač
This also gives the same error. requires=IS_IN_DB(db(db.report_attribute.entry_attribute_id == db. entry_attribute.id).select(db.report_attribute.ALL, db.entry_attribute.ALL), "report_attribute.id", '%(entry_attribute.name)s', zero=T("-- Odaberite --" )), -- --- You received this message bec

Re: [web2py] IS IN DB

2013-05-08 Thread Domagoj Kovač
ius Assef > > > > On Wed, May 8, 2013 at 5:20 AM, Domagoj Kovač > > > wrote: > > Hi, > > > > i have three tables > > entry_attribute > > idint > > name varchar > > description

[web2py] IS IN DB

2013-05-08 Thread Domagoj Kovač
Hi, i have three tables entry_attribute idint name varchar description longtext field_typevarchar field_sizeint report_attribute idint report_id int entry_attribute_idint sorting

[web2py] Re: form.vars form type GET

2013-05-03 Thread Domagoj Kovač
I needed to add keepvalues form.validate(request_vars=request.get_vars, keepvalues=True) -- --- 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.

[web2py] Re: form.vars form type GET

2013-05-03 Thread Domagoj Kovač
I have a problem, form.validate(request_vars=request.get_vars) works but only when form is not submitted, when i submit my form my values are erased. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and sto

[web2py] Re: form.vars form type GET

2013-05-03 Thread Domagoj Kovač
request.get_vars.repeated - i have my value here, but doesn't work. form.vars.repeated = request.get_vars.repeated -- --- 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 e

Re: [web2py] Dynamic IS_IN_DB

2013-05-03 Thread Domagoj Kovač
Thanks, i used first method. -- --- 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.go

[web2py] form.vars form type GET

2013-05-03 Thread Domagoj Kovač
Hi, i have a form like this. fields.append(Field("date_from", "date", requires=IS_DATE(), label=LABEL("Datum od", _for= "no_table_date_from"))) fields.append(Field("date_to", "date", requires=IS_D

[web2py] Dynamic IS_IN_DB

2013-05-02 Thread Domagoj Kovač
Hi, i want to have dynamic query in my IS_IN_DB validator: requires = IS_IN_DB(db((db.asset_class.id == 10) | (db.asset_class.id == 9) | (db.asset_class.id == 7)), 'asset_class.id', '%(name)s', zero=T("-- Odaberite --")) I want to have q

[web2py] Re: Empty IS IN DB

2013-05-02 Thread Domagoj Kovač
Maybe i can remove options after they are created: Something like: for option in form.elements('select[name=m_id] option'): option.update(_class='repeated') but i don't know what is the method for option delete. I can always add some class, called hidden, but i want to remov

[web2py] Empty IS IN DB

2013-05-02 Thread Domagoj Kovač
Hi, i have code like this. fields.append(Field("m_class_id", "reference asset_class", required=True, requires=IS_IN_DB(db, 'asset_class.id', '%(name)s',zero =T("-- Odaberite --")), label=LABEL("M CLASS", _for="no_table_m_

[web2py] Form method = GET and keepvalues

2013-04-29 Thread Domagoj Kovač
Hi, In my grid i have a search form that filters grid results. Is it possible to have SQLFORM.factory to have _method=GET and to keep values on form.validate: Something like: fields = [] fields.append(Field("asset_id", requires=IS_EMPTY_OR(IS_IN_DB(db, 'asset.id

Re: [web2py] Re: response.download

2013-04-29 Thread Domagoj Kovač
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_o

[web2py] Re: response.download

2013-04-29 Thread Domagoj Kovač
Where can i open a ticket about this? I am not sure now. I have an image, lets say logo. I want to display this image via: {{=IMG(_src=URL("default", "download", args="logo.png"), _width="170px")}} I thought if i move my image to static/images folder then this would work. {{=IMG(_src="/static/

[web2py] Re: IS IN DB

2013-04-29 Thread Domagoj Kovač
that will do a db query for each option > in the list. > > Another option would be to create a custom widget for the field. You can > base it on the > OptionsWidget<https://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#224>. > > You can subclass that cla

[web2py] IS IN DB

2013-04-26 Thread Domagoj Kovač
Hi, i have a question. I have a IS_IN_DB validator. fields.append(Field("event_class_id", "reference event_class", required=True, requires=IS_IN_DB(db, 'event_class.id', '%(name)s',zero =T("-- Odaberite --")), label=LABEL(

[web2py] Re: Count and distinct

2013-04-25 Thread Domagoj Kovač
I understand now, there are two pepople named Alex and one named Bob. Much better example would be to put example like: >>> for row in db(db.person.id==db.thing.owner_id).select( db.person.name, count, groupby=db.person.name): print row.person.name, row[count] Alex 2 Bob 4 Here

[web2py] Re: Count and distinct

2013-04-25 Thread Domagoj Kovač
count = db.person.id.count() I understand this line of code, it is obvious that limitby clause here would be stupid. >>> for row in db(db.person.id==db.thing.owner_id).select( db.person.name, count, groupby=db.person.name): print row.person.name, row[count] Alex 2 Bob 1 I don'

[web2py] Re: Count and distinct

2013-04-25 Thread Domagoj Kovač
You misunderstood me. In the post above there is a regular select without limitby clause, i want to limit number of records in that select, so i assume count will be also limit? -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubsc

[web2py] Re: Count and distinct

2013-04-25 Thread Domagoj Kovač
In documentation i see: >>> count = db.person.id.count() >>> for row in db(db.person.id==db.thing.owner_id).select( db.person.name, count, groupby=db.person.name): print row.person.name, row[count] Alex 2 Bob 1 but i need to limit the number of rows -- --- You received this m

[web2py] Count and distinct

2013-04-25 Thread Domagoj Kovač
Hi, i have a count problem. I have two queries. assets = db((db.asset.asset_class_id == asset_class_id) & (db.asset_value.asset_id == db.asset.id) & (db.asset_value.location_value == location_id)).select(db.asset.ALL,

[web2py] Re: paging

2013-04-24 Thread Domagoj Kovač
Thanks Massimo, I saw there is a system of plugins, but i wasn't sure are they the right choice for something like this. I will check them one more time. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and

[web2py] paging

2013-04-24 Thread Domagoj Kovač
Hi guys. I have this code in my view: {{if rows:}} {{number_of_pages = int(math.floor(number_of_records/ settings["items_per_page"]))}} {{if request.args:}} {{current_page = int(request.args[0])}} {{else:}}

[web2py] Re: placeholder

2013-04-23 Thread Domagoj Kovač
Thanks man,i know placeholders don't work in all browsers. I can handle that via javascript if tag is present, although i don't think that is necessary. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and s

[web2py] placeholder

2013-04-23 Thread Domagoj Kovač
Hi, i have a code: {{form.custom.widget.email["_placeholder"] = T("E-mail adresa")}} {{=form.custom.widget.email}} And here i get placeholder attribute on my input element, while here: {{form.custom.widget.password["_placeholder"] = T("Lozinka")}} {{=form.custom.widget.password}} i don't get p

[web2py] response.download

2013-04-23 Thread Domagoj Kovač
Hi, I have a download function. def download(): return response.download(request, db) in my controller i have a line of code: elif field_type == "UPLOAD": field_value = A(T("Download attachment"), _href=URL("default", "download", args=asset_value.upload_value), _target="blank")

[web2py] Re: Custom IS IN DB

2013-04-19 Thread Domagoj Kovač
Thanks, that is what i need. -- --- 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.go

[web2py] Custom IS IN DB

2013-04-19 Thread Domagoj Kovač
Hi, i have a table of attributes like this: ID field_name field_type 4 name STRING 5 description TEXT 6 power INTEGER 7 available BOOLEAN 8 price DECIMAL 9 date_of_entry DATE 11 companies STRING-LOV Each of this entries represents field on a form. Type STRING-LOV

[web2py] Re: SQLFORM.factory

2013-04-17 Thread Domagoj Kovač
This works: {{=form.custom.label[asset_class_attribute. asset_attribute_id.name]}} {{=form.custom.widget[asset_class_attribute. asset_attribute_id.name]}} Thanks! -- --- You received this message because you are subscribed to the Google Groups "web2py-

[web2py] Re: SQLFORM.factory

2013-04-17 Thread Domagoj Kovač
Thanks guys! I will try it. -- --- 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.goo

[web2py] SQLFORM.factory

2013-04-17 Thread Domagoj Kovač
Hi, i am trying to make a form with dinamic fields and i am using SQLFORM.factory. I have a table where i have a list of fields in my form. in my controller i have: fields = [] for asset_class_attribute in asset_class_attributes: field_name = asset_class_attribute.

[web2py] Re: Routes

2013-04-15 Thread Domagoj Kovač
In routes.example.py folder i found: This simple router is used for setting languages from app/languages directory as a part of the application path: app//controller/function Language from default.py or 'en' (if the file is not found) is used as a default_language If i understand correctly this

[web2py] Routes

2013-04-15 Thread Domagoj Kovač
Hi, i have a problem. In my routes.py file in root folder i have: routers = dict( # base router BASE=dict(default_application='init'), ) in routes in my application i have: routes_in = ( ('/$u/login', '/default/login/$u/'), ) I want to have url like /username/login and this is

[web2py] Re: request.env.http_referrer

2013-04-12 Thread Domagoj Kovač
I have a typo :(, request.env.http_referer works. On Friday, April 12, 2013 1:27:10 PM UTC+2, Domagoj Kovač wrote: > > Hi, > > i am using request.env.http_referrer, and i always get None, is there > something i did wrong? > -- --- You received this message because you are

[web2py] request.env.http_referrer

2013-04-12 Thread Domagoj Kovač
Hi, i am using request.env.http_referrer, and i always get None, is there something i did wrong? -- --- 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+u

[web2py] Re: Form hidden field

2013-04-11 Thread Domagoj Kovač
I managed to do it with: {{form.custom.widget.zoom["_hidden"] = "hidden"}} On Thursday, April 11, 2013 4:46:44 PM UTC+2, Domagoj Kovač wrote: > > Hi, > > i have a problem. > > This is my table definition. > > db.define_table('lo

[web2py] Form hidden field

2013-04-11 Thread Domagoj Kovač
Hi, i have a problem. This is my table definition. db.define_table('locations', Field('name', 'string', required=True, requires=IS_NOT_EMPTY(), label=LABEL(T("Naziv"), _for="locations_name")), Field('par

[web2py] Preorder tree traversal

2013-04-11 Thread Domagoj Kovač
HI, i saw there was a discussion about preorder tree traversal https://groups.google.com/forum/?fromgroups=#!topic/web2py/Bw792rYt_nM. The thing that i don't understand is how to display this data in a form in a select dropdown. I think i must use SQLForm.factory but i am not sure if i must cr

[web2py] Re: Default login script

2013-04-11 Thread Domagoj Kovač
I found it: auth.settings.login_url = URL('user', args='login') On Thursday, April 11, 2013 9:35:09 AM UTC+2, Domagoj Kovač wrote: > > Hi, > > is there anyway that i could change default login script. So when session > expires user is logged o

[web2py] Default login script

2013-04-11 Thread Domagoj Kovač
Hi, is there anyway that i could change default login script. So when session expires user is logged out and redirected to page i provide. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving

Re: [web2py] db.count()

2013-04-10 Thread Domagoj Kovač
I tried Antonies code and it works. 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 ht

[web2py] db.count()

2013-04-10 Thread Domagoj Kovač
Hi, i have this line of code: number_of_records = db().count(db.countries.id) i am receiving an error: near ";": syntax error (self=, *a=('SELECT count(DISTINCT countries.id) FROM ;',), **b={}) What is wrong? -- --- You received this message because you are subscribed to the Google Groups

[web2py] Re: Multi-tenany and url routing

2013-04-08 Thread Domagoj Kovač
For now i will try a bit different approach. I will have myapp/company_name_value/login when user logs in i will set a cookie with company_name_value and session.company_id. When user is logged out, i will use cookie value for redirection to proper login page. My initial idea was to handle eve

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Domagoj Kovač
I added companies definition in db.py. It will be ok for now. Thanks. On Monday, April 8, 2013 11:05:22 AM UTC+2, Domagoj Kovač wrote: > > Is there any way to load models manually? > > On Monday, April 8, 2013 10:23:55 AM UTC+2, Niphlod wrote: >> >> uhm. if you want that

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Domagoj Kovač
t; You simply have a conditional model that for your app logic doesn't need > to be conditional . > > On Monday, April 8, 2013 10:20:56 AM UTC+2, Domagoj Kovač wrote: >> >> I see it now. Thanks man! I have a different problem now, now i don't get >> any errors

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Domagoj Kovač
DB(db, (db, 'companies.id', '%(name)s')) > > needs to be > > requires=IS_IN_DB(db, 'companies.id', '%(name)s') > > > > On Monday, April 8, 2013 9:39:15 AM UTC+2, Domagoj Kovač wrote: >> >> Hi, >> >> i tri

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Domagoj Kovač
You need to change your IS_IN_DB call to (db, 'companies.id', >> '%(name)s') ... notice the ticks around companies.id, it's a string >> When you do it that way, the db.companies table will be called not at >> "models definition" time, but at the

[web2py] Re: Multi-tenany and url routing

2013-04-05 Thread Domagoj Kovač
Does anyone have any advice? On Thursday, April 4, 2013 2:29:55 PM UTC+2, Domagoj Kovač wrote: > > Hi Guys, > > i am new to web2py. I have a problem and i am not sure how to approach it. > I am working on a multitenant application. > > I have two tables: > > Tena

[web2py] Re: auth.settings.extra_fields

2013-04-05 Thread Domagoj Kovač
is rendered (so, > allowing all the models to be executed before --> having at your > disposition the companies table) > > On Friday, April 5, 2013 5:11:32 PM UTC+2, Domagoj Kovač wrote: >> >> Thanks guys, >> >> right now my db.py looks like this: >>

[web2py] Re: auth.settings.extra_fields

2013-04-05 Thread Domagoj Kovač
Thanks guys, right now my db.py looks like this: from gluon.tools import Auth, Crud, Service, PluginManager, prettydate auth = Auth(db) crud, service, plugins = Crud(db), Service(), PluginManager() db.define_table('companies', Field('name', 'string', require

[web2py] auth.settings.extra_fields

2013-04-05 Thread Domagoj Kovač
Hi, i have a problem. In my models/db.py file i have this code: auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean', default=False), Field('company_id', 'reference companies', requires=IS_IN_DB(db,db.companies.id))] In my models/co

[web2py] Re: auth.settings.extra_fields['auth_user']

2013-04-04 Thread Domagoj Kovač
Thanks guys, i solved it other way. On Thursday, April 4, 2013 3:17:49 AM UTC+2, 黄祥 wrote: > > please try this in your db.py: > > db.define_table('company', > Field('company_name'), > Field('website'), > format='%(company_name)s') > > auth.settings.extra_fields['auth_user']=[ > Fie

[web2py] Multi-tenany and url routing

2013-04-04 Thread Domagoj Kovač
Hi Guys, i am new to web2py. I have a problem and i am not sure how to approach it. I am working on a multitenant application. I have two tables: Tenants - id - name - url_sufix - active - deleted Tenans_users - tenant_id - user_id in tenants table url_sufix is a url_su

[web2py] auth.settings.extra_fields['auth_user']

2013-04-03 Thread Domagoj Kovač
Hi folks, i have a problem. I am using form widget i am trying to customize registration form. I my model i added auth.settings.extra_fields['auth_user'] = [Field('company_id', 'string',required =True)] in my register.html view i have. {{form.custom.widget.company_id['_class'] =