Hi Joel,
Thanks for your reply.
This works:
('', False, A('TaC',
_href='https://static.domain.com/files/Terms_and_Conditions.pdf',
_target="_blank", vars=dict(attachment=True)))
For some reason the first attribute is not used as the link text.
Kind regards,
Annet
--
Resources:
-
I have the following link in a view:
{{=A('TaC',
_href='https://static.domain.com/files/Terms_and_Conditions.pdf',
_target="_blank", vars=dict(attachment=True))}}
I want to convert it to a menu item
('TaC', False, URL(???))
How do I convert the _href to a URL()
Kind regards
Annet
--
Hi Anthony,
Thanks for helping me solve this problem, I very much appreciate your help.
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You
HI Anthony,
Thanks for your reply.
> What is the SQL you are trying to produce?
>
SELECT ...
FROM ntw_edge
INNER JOIN ntw_edge_alias ON ntw_edge.inID=alias_edge.outID
INNER JOIN vtx_vertex ON ntw_edge.inID=vtx_vertex.id
INNER JOIN ntw_edge_label_set ON ntw_edge.labelID=ntw_edge_label_set.id
Hi Anthony,
Thanks for your reply.
I get the results I want. Two more questions, using this syntax, how would
I join
ntw_edge_inID on vtx_vertex.id
and
ntw_edge_labelID on ntw_edge_label_set.id
without ending up with more records than I have now.
Second, up to now I have been writing
I defined the following table:
db.define_table('ntw_edge',
Field('outID', 'reference vtx_vertex'),
Field('inID', 'reference vtx_vertex'),
Field('labelID', 'reference ntw_edge_label_set'),
Field('networkkey', type='integer', default=1),
migrate = False)
The database contains
Hi,
I think it should be:
left=db.requestlist.on(db.procedures.id == db.requestlist.proceduresid)
Regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report
Hi Anthony,
Thanks for your reply and clear explanation of what happens.
I have no further questions.
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list
I have the following function:
def app_settings():
vertexID = session.vertexID
record = table(vertexID=vertexID)
form = SQLFORM(table, record, showid=False)
if form.validate():
if form.deleted:
...
else:
viewtypeID =
Hi Anthony,
Thanks for helping me solve the issue, I very much appreciate your help.
@richard.
Thanks for your reply, I had a look at bindfs, I work with Linux and had a
symbolic link on myapp/static/uploads I am not sure bindfs let me upload
files to myapp/static/uploads and store them in a
Hi Anthony,
Thanks for your reply.
After reading the parts on download() in chapter 7 and 9 I wrote the
following functions:
def logo():
vertexID = session.vertexID
table.vertexID.default = vertexID
folder = 'vertexID' + str(vertexID)
table.image.uploadfolder =
Thank you all for your replies,
This works :
table.image.uploadfolder = '/home/webapps/uploads'
to upload the images into separate folders I made the following adjustment:
folder = 'vertexID' + str(vertexID)
table.image.uploadfolder = os.path.join('/home/webapps/uploads/' + folder)
The
In web2py I have an init application and an adminmod application containing
the model, module and static files.
To manage images I have the following code in a function:
table.image.uploadfolder = os.path.join(request.env.applications_parent,
'applications',
Hi Paolo,
Maybe
>
> .web2py-menu li:nth-of-type(2) {padding:0;}
>
>
Yes, that solves the problem, thank you for your help.
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
Hi Paolo,
Thanks for your reply. The problem is that the padding is on the item
not the btn one.
My menu is rendered as follows:
class="fa fa-search"
Log
in
>Open
account
The padding is on the second item which does not have a class I can
reference in my css.
Removing the
I have the following menu:
response.application_menu = [
(CAT(I(_class="fa fa-search")), False, URL('default', 'search')),
(CAT(SPAN('Log in', _class="btn btn-primary")), False, URL('com',
'default', 'user', args='login', scheme=SECURESCHEME, host=COMDOMAIN)),
(CAT(SPAN('Open
Hi Leonel,
Thanks for your reply. I did as you did, I updated the list.
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You
I have a user complaining that my application does not accept
his URL ending on .online doesn't Web2py validate this kind of
URL?
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
I have one application (adminmodel) containing models, modules and static
files and three other applications
using these models, modules and static files. Two of the three applications
have been developed
independently of each other, and have their own register and login
functions. All
Hi Kiran and Anthony,
Thanks for your replies.
Indeed I have a form with field 'label' and a var 'label in the URL.
Changing request.vars to
request.get_vars solved the issue.
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
-
I have the following URL:
http://127.0.0.1:8000/com/shortcut/target/1349?edge=34=1297=NASM+Certified+Personal+Trainer&_signature=9c33ff589c78426ce3fcdf2f53f4408028189128
In de target function I have these lines of code:
label = request.vars.label
get_flash(response, invertex.name + ' already
I have the following query and form:
user = db.auth_user(vertexID=vertexID)
form = SQLFORM.factory(db.auth_user, db.auth_dummy,
extra_fields=extra_fields)
If the form validates I want to update user with data I selected from other
tables and
with data from the form. I have the following
Thank you both for your replies.
In the default/user function I have form=auth() which calls accepts by
itself.
Your reference to the book was helpful, I think something like:
auth.settings.profile_onaccept = lambda form: __on_profile()
def __on_profile()
row = db.table_name(ID=form.ID)
I am hosting my Web2py applications at Webfaction. I asked support the
folIowing question:
am developing sort of a network application, to keep track of the
communication with my customers I am looking for an application like
WebFaction's ticketing system.
They recommend installing osTicket,
When a user updates his profile I want to use the form data to update data
in another table,
what is the best way to do so?
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
Hi Anthony,
Thanks for your reply. Glad my code is not a problem.
Kind regards,
Annet
> Your code is not a problem, as it is all Python code that gets executed at
> run time. The problem is with Python code within the "include", "extend",
> and "block" statements, which are part of the
Hi Anthony,
I just read:
Any Python code in the template directives (i.e., "include", "exclude",
> "block") is evaluated at compile time, as the directives are needed to
> create the compiled views. However, in this case you include an object that
> is only available at run time ("session"),
Hi Dave,
Thanks for your reply.
> Wrap the A() with a CAT() ?
>
>
I had to wrap the whole message in CAT()
response.flash = CAT('Please contact admin to report the issue using the
', A('contact form', _href=URL('init', 'util', 'contactform')))
Kind regards,
Annet
--
Resources:
-
I want to add a link to a flash message, something like:
response.flash = 'Please contact admin to report the issue using the ' +
A('contact form', _href=URL('init', 'util', 'contactform'))
This does not work for you cannot concatenate a string with the A helper.
KInd regards,
Annet
--
Hi,
Thanks for your reply.
I went for the short circuit option:
if request.application == 'admin':
redirect('https://ldc.leonexus.nl')
What would the routes.py solution look like? I have a parametric routes.py
which amongst others
contains the following lines of code:
routers = dict(
Hi Anthony,
Thanks for your reply.
I apologize for not being clear enough,
I have one installation of web2py and 4 applications each being referenced
by their own domain.
dbadmin by admin.mydomain.com
init by www.mydomain,com
etc.
I only want acces the web2py interface via admin.mydomain.com
Hi,
Thanks for your reply. You mean an empty .py file named DISABLED
What does ATM stand for?
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report
I have an application with limited functionality in which I want to access
web2py's admin interface.
I have 3 application in the same web2py installation in which I want to
disable the admin interface.
Is this possible and how would I do this.
Kind regards,
Annet
--
Resources:
-
I wonder whether there is a validator on auth_membership user_id and
group_id
I found that I can add the same membership multiple times which is not what
I want.
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py
Hi Richard,
Thanks for your reply, you are right, setting default to None solves the
problem.
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report
Hi Anthony and Richard,
Thank you both for your replies
It's probably a good idea to strip any leading/trailing whitespace before
> the names are ever inserted in the database.
>
To solve the issue I use .strip()
Kind regards,
Annet
--
Resources:
- http://web2py.com
-
In a table I defined the following field:
Field('birthday', writable=False, readable=False, **isemptyorisdate),
isemptyorisdate has been defined like this:
isemptyorisdate = dict(type='date', default='',
requires=IS_EMPTY_OR(IS_DATE(format='%d-%m-%Y',
I have a form in which the user enter his name, for example: 'Thompson,
Brian'
When I execute the following query:
rowset = db(db.vtx_vertex.name.ilike(nameform.vars.name))
This query return the correct result.
However, when db.vtx_vertex.name is 'Thompson, Brian ' (a space after Brian)
and
Hi Anthony,
Thanks for your reply. Problem solved.
Best regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message
In a table I defined a field:
Field('customLabel', length=128, requires=[IS_LENGTH(32), IS_NOT_EMPTY()]),
When the user updates this field I need the update to cascade to a field
label
in another table:
Field('label', length=128, default='', requires=IS_IN_DB(db,
I have the following query:
rows =
db(db.ntw_edge_label_set.vertexID==vertexID).select(db.ntw_edge_label_set.myLabel).as_list()
which returns:
[{'myLabel': 'NASM Personal Trainers'}, {'myLabel': 'Traineeship'}]
when I try:
labelList = [row.myLabel for row in rows]
I get the following
Hi Massimo,
Thanks for your reply, problem solved nicely.
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this
In my controller I have the following code:
form = SQLFORM.factory(db.auth_user, db.auth_dummy,
extra_fields=extra_fields)
form.append(Recaptcha2(public_key = '...', private_key = ''))
When I have a view with {{=form}} the recaptcha displays correctly, I
changed
the view to display a
Use the IS_IMAGE() validator
http://web2py.com/books/default/chapter/29/07/forms-and-validators#IS_IMAGE
requires = IS_IMAGE(extensions=('jpg', 'png'))
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source
Hi Niphold,
Thanks for your reply and explanation, problem solved.
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received
I have the following menu:
response.app_menu = [(CAT(SPAN('Connect', _class="btn btn-default",
_target="_blank")), False, URL())]
I want to add a Bootstrap tooltip to the button, I tried:
response.app_menu = [(CAT(SPAN('Connect', _class="btn btn-default",
_target="_blank",
I have this settings:
auth.settings.actions_disabled = ['register', 'impersonate', 'groups']
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
and a custom register function in the default controller:
def register():
form =
Hi Anthony,
Thanks for your reply.
._select() works.
I have not been able to figure out the 'one nested select' solution.
I have a table with network edges, I need the ids of the edges to which a
vertex connects. for example out = 1153 connects to in = (6, 28, 496, 1024)
Then I want to use in
I just tried
vertices = db(db.ntw_edge.outID==1151).
select(db.ntw_edge.inID, distinct=db.ntw_edge.inID).as_list()
events = db(db.event_list.vertexID.
belongs(vertices)).select()
but that gives the following error:
unhashable type: 'dict'
Kind regards,
Annet
--
Resources:
-
I have the following table definition
db.define_table('ntw_edge',
Field('outID', 'reference vtx_vertex', default='',
requires=[IS_IN_DB(db, 'vtx_vertex.id', '%(name)s')], ondelete='CASCADE',
notnull=True, label='Out *', represent=lambda outID, row:
Hi Anthony,
Thanks for your reply.
.register already calls .validate - you cannot call it twice (by design,
> the CSRF token survives only one validation).
I solved it by replacing form = auth.register() with:
form = SQLFORM.factory(db.auth_user,
Field('password_two',
Just overwrite the Bootstrap css in your applications css:
.navbar-default .navbar-nav > li > a:hover {background-color: #1f2f3f;}
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
I have a custom register function:
def myregister():
response.view = 'default/myregister.html'
form = auth.register()
if form.validate():
# my custom code
elif form.errors:
get_flash(response, None, 'danger', 'error')
elif not response.flash:
I have an auth_user table to which I added some extra fields. I use
form=auth.register() and a custom form to register users.
I want some users to provide me with some more data, so
I created an auth_dummy table to store these data. When
in this case I use:
form = SQLFORM.factory(db_auth_user,
Hi Richard,
Thanks for your reply, renaming the application did not solve the problem.
However,
having a closer look at my code, I found that in:
upload=URL('dbmodel', 'static', 'uploads', folder, args=request.vars.image))
'static', 'uploads' should be 'static/uploads'
I am sorry for
I have the following function:
def logo():
vertexID = get_vertexID(auth, session)
folder = 'vertexID' + str(vertexID)
table.image.uploadfolder =
os.path.join(request.env.applications_parent, 'applications',
'dbmodel', 'static', 'uploads',
Hi Massimiliano,
Thanks for your helpful reply.
print db(db.ntw_edge.outID==1147)._select(left=db.ntw_edge.on(db.
> ntw_edge.inID==alias_edge.outID))
>
Web2py generates:
SELECT alias_edge.outid, alias_edge.inid, alias_edge.label,
ntw_edge.outid, ntw_edge.inid, ntw_edge.label
FROM ntw_edge
I have the following SQL query (in Postgresql):
SELECT ntw_edge.outid, ntw_edge.inid, ntw_edge.label, alias_edge.inid,
alias_edge.outid, alias_edge.label
FROM ntw_edge
LEFT OUTER JOIN ntw_edge AS alias_edge
ON ntw_edge.inid=alias_edge.outid
WHERE ntw_edge.outid=1147;
In web2py I have:
def
I installed Web2py at Webfaction. In Web2py I have an application dbmodel
that contains my models,
static files and uploads. I created two static only applications one two
serve the content of static and one
to serve the content form uploads.
So any request starting with
I have a routes.py file in web2py's home directory which contains the
follwing code:
routes_onerror = [
(r'init/*', r'/error/default/index')
,(r'org/*', r'/error/default/index')
,(r'*/404', r'/error/default/index')
,(r'*/*', r'/error/default/index')
]
# specify action in charge of
Hi,
I am not sure I understand your question correctly
How do I change the style of a form using SQLFORM?
>
In appconfig.ini you can set:
; form styling
[forms]
formstyle = bootstrap3_stacked
separator =
and then in the db.py file:
## choose a style for forms
response.formstyle =
I have a module containing text constants which I would like to translate.
T('Yes, I accept the Terms and Conditions * ')
When I save the module I get the following error flash:
failed to reload module because;
name 'T' is not defined
Is it possible to use T() in a module, if so, what files do
Hi Niphlod,
Thanks for your reply.
I have been trying to get the self-refrence and alias to work, but I got
stuck. What i've got sofar is:
vertexfrom = db.edg_edge.with_alias('vertexfrom')
rows = db((db.edg_edge.toID==8) & (db.edg_edge.fromID==db.vtx_vertex.id))\
101 - 163 of 163 matches
Mail list logo