[web2py] Transferring the whole database from a python 2.7 framework to 3.11 framework

2024-05-22 Thread mostwanted
Hi guys, my app has been running on python2.7 since its inception, I have 
been reluctant to make the big change but now very critical updates a force 
the change. How do I move the entire database with all its images and data 
to the new app?

I have tried a few things and a few things, The appadmin interface import 
function is not working so I had to write a few scripts. Some tables 
without references were successful but I am stuck on bigger tables with 
images and table references I keep getting primarykey integrity error.

Please help

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0a0495ab-7ca8-4680-aa56-19d53c74e50bn%40googlegroups.com.


[web2py] Re: Exception Error: 'Field' object has no attribute '__dir__'

2023-12-12 Thread mostwanted
Is there something wrong with the upload functionality or is just my app?

On Friday, December 8, 2023 at 7:39:49 PM UTC+2 mostwanted wrote:

> Hi guys, I recently 'upgraded' my web2py version to the latest version 
> (2.27.1) but i've forgotten the previous version. Now suddenly when i try 
> to submit forms i get this error:   'Field' object has no attribute 
> '__dir__'
>
> Below is the tracebeack
> Traceback
> Traceback (most recent call last):
> File "/home/sesoa/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
> File "/home/sesoa/web2py/applications/init/controllers/default.py" 
> <https://www.sesoa.co.bw/admin/default/edit/init/controllers/default.py>, 
> line 
> 920, in 
> File "/home/sesoa/web2py/gluon/globals.py", line 463, in 
> self._caller = lambda f: f()
> File "/home/sesoa/web2py/applications/init/controllers/default.py" 
> <https://www.sesoa.co.bw/admin/default/edit/init/controllers/default.py>, 
> line 
> 315, in business_registration
> if form.process().accepted:
> File "/home/sesoa/web2py/gluon/html.py", line 2410, in process
> self.validate(**kwargs)
> File "/home/sesoa/web2py/gluon/html.py", line 2349, in validate
> if self.accepts(**kwargs):
> File "/home/sesoa/web2py/gluon/sqlhtml.py", line 2132, in accepts
> source_file, original_filename, field.uploadfolder
> File "/home/sesoa/web2py/gluon/packages/dal/pydal/objects.py", line 2075, in 
> store
> self._tablename if '_tablename' in self.__dir__() and self._tablename else 
> 'no_table',
> AttributeError: 'Field' object has no attribute '__dir__'
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/77ea5827-253d-4edd-b6fc-e2f4e4b7a423n%40googlegroups.com.


[web2py] Exception Error: 'Field' object has no attribute '__dir__'

2023-12-08 Thread mostwanted
Hi guys, I recently 'upgraded' my web2py version to the latest version 
(2.27.1) but i've forgotten the previous version. Now suddenly when i try 
to submit forms i get this error:   'Field' object has no attribute 
'__dir__'

Below is the tracebeack
Traceback
Traceback (most recent call last):
File "/home/sesoa/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/home/sesoa/web2py/applications/init/controllers/default.py" 
, line 
920, in 
File "/home/sesoa/web2py/gluon/globals.py", line 463, in 
self._caller = lambda f: f()
File "/home/sesoa/web2py/applications/init/controllers/default.py" 
, line 
315, in business_registration
if form.process().accepted:
File "/home/sesoa/web2py/gluon/html.py", line 2410, in process
self.validate(**kwargs)
File "/home/sesoa/web2py/gluon/html.py", line 2349, in validate
if self.accepts(**kwargs):
File "/home/sesoa/web2py/gluon/sqlhtml.py", line 2132, in accepts
source_file, original_filename, field.uploadfolder
File "/home/sesoa/web2py/gluon/packages/dal/pydal/objects.py", line 2075, in 
store
self._tablename if '_tablename' in self.__dir__() and self._tablename else 
'no_table',
AttributeError: 'Field' object has no attribute '__dir__'

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5d212ef7-60fa-443e-b54c-bd9e8005e4e6n%40googlegroups.com.


[web2py] Displaying images from web2py as a server

2023-10-08 Thread mostwanted
 I have a little functionality here where i'm pulling information from a 
web2py server and displaying it on a kivy app for the user, all the other 
details are displaying but the image is failing to display & I get the 
error:* [ERROR  ] [AsyncImage  ] Not found 
.*

What am I doing wrong? How do I get the image to display coz its clearly 
there?

*WEB2PY CODE:*
@request.restful()
def api_list_clients():
def GET(*args, **vars):
query = db().select(db.person.ALL)
return response.json(dict(clients=query.as_list()))
return locals()

*KIVY CODE:*
def read_from_server(self):
self.root.ids.display_screen.clear_widgets()
response = requests.get("
http://localhost:8000/clients/default/api_list_clients;)
if response.status_code == 200:
print("Response content:", response.content)
try:
data = response.json()
clients = data.get("clients", [])
for client in clients:
name = client.get("name")
surname = client.get("surname")
cell = client.get("cell")
email = client.get("email")
*image_url = client.get("image")  *
details_layout = BoxLayout(orientation='vertical', 
spacing=10)
name = MDLabel(text=name, halign="center")
surname=MDLabel(text=surname, halign='center')
cell=MDLabel(text=cell, halign='center')
email=MDLabel(text=email, halign='center')
details_layout.add_widget(name)
details_layout.add_widget(surname)
details_layout.add_widget(cell)
details_layout.add_widget(email)
*image = AsyncImage(source=image_url)*
*details_layout.add_widget(image)*
self.root.ids.display_screen.add_widget(details_layout)
except json.JSONDecodeError as e:
print("Error parsing JSON response:", e)
elif response.status_code == 204:
# Handle empty response (No Content)
print("No clients found.")
else:
print("Failed to read from server. Status code:", 
response.status_code)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7f66b3bf-56ce-46fe-8567-691bf0655ee6n%40googlegroups.com.


[web2py] Failing to download search results as csv

2023-08-22 Thread mostwanted
Hi guys, i need help downloading results as csv, i am failing dismally I 
dont know what to do
After the search results return values I want to download those results 
into my computer somewhere the current version of my code is giving me an 
error: 
* string indices must be integers*

Here is my code
*FROM THE SEARCH VIEW:*
* Download Results as CSV*

*DOWNLOAD CONTROLLER:*
























*import csvfrom io import StringIOdef download_results():# Retrieve the 
filtered recordsrecords = request.vars#  CSV datacsv_data = []  
  csv_data.append(['First Name', 'Last Name', 'Program', 'Study Mode'])  # 
Header rowfor record in records:
csv_data.append([record['first_name'], record['last_name'], 
record['program'], record['study_mode']])# Create a response to 
download the CSV fileresponse.headers['Content-Type'] = 'text/csv'
response.headers['Content-Disposition'] = 'attachment; 
filename=registration_results.csv'# Write CSV data to a StringIO 
objectoutput = StringIO()csv_writer = csv.writer(output)for row 
in csv_data:csv_writer.writerow(row)# Return the content as 
bytesreturn output.getvalue().encode('utf-8')* 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a0d814f4-83b7-402a-8aa8-aa17528625a1n%40googlegroups.com.


[web2py] Re: Extracting just submitted details in a redirect

2023-08-20 Thread mostwanted
I managed to get it going, thanks for highlighting that mistake 















*form=SQLFORM(db.store_registration)if form.process().accepted:
response.flash=T('Details Registered')student_id = 
form.vars.id_number# Redirect to payments view with student's name 
as parameterredirect(URL('default', 'payments', vars={'student_id': 
student_id}))return locals()def payments():student_id = 
request.vars.student_id# Load student's information from the database  
  student = db(db.store_registration.id_number == 
student_id).select().first()if student is None:raise 
HTTP(404, "Student not found")*









*db.payments.student.default=student.idform = SQLFORM(db.payments)  
  #form.vars.student = student.id  # Set the student reference in the 
payment formif form.process().accepted:response.flash = 
T('Payment details submitted')redirect(URL('default', 
'student_registration'))return locals()*

On Sunday, August 20, 2023 at 3:25:43 PM UTC+2 Clemens wrote:

> Hi,
>
> could it be that the problem is, you're passing the students name 
> (vars={'student_name': student_name}) but then reference 
> to form.vars.student as student.id?
>
> Regards
>
> On Sunday, August 20, 2023 at 1:04:51 PM UTC+2 mostwanted wrote:
>
>> I have a student registration form that immediately after registering a 
>> student I want to use those details in another form, a payments form to 
>> enter that student's payment status but my code keeps returning  none like 
>> student is not available, I am doing something wrong here please assist me 
>> figure it out or show me a better way of doing achieving the same logic:
>>
>> *CODE:*
>> *def registration():*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *form=SQLFORM(db.store_registration)if form.process().accepted:  
>>   response.flash=T('Details Registered')student_name = 
>> "{form.vars.first_name} {form.vars.last_name}"# Redirect to 
>> payments view with student's name as parameter
>> redirect(URL('default', 'payments', vars={'student_name': student_name}))  
>>   return locals()def payments():student_name = 
>> request.vars.student_name# Loading student's information from the 
>> databasestudent = db(db.store_registration.first_name + ' ' + 
>> db.store_registration.last_name == student_name).select().first()if 
>> student is None:raise HTTP(404, "Student not found")*
>>
>> * form.vars.student = student.id <http://student.id>  # Set the student 
>> reference in the payment form*
>>
>>
>> *form = SQLFORM(db.payments)if form.process().accepted:
>> response.flash = T('Payment details submitted')return locals()*
>>
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9525a8bb-682d-4f8a-adb1-7685ee81d26bn%40googlegroups.com.


[web2py] Extracting just submitted details in a redirect

2023-08-20 Thread mostwanted
I have a student registration form that immediately after registering a 
student I want to use those details in another form, a payments form to 
enter that student's payment status but my code keeps returning  none like 
student is not available, I am doing something wrong here please assist me 
figure it out or show me a better way of doing achieving the same logic:

*CODE:*
*def registration():*















*form=SQLFORM(db.store_registration)if form.process().accepted:
response.flash=T('Details Registered')student_name = 
"{form.vars.first_name} {form.vars.last_name}"# Redirect to 
payments view with student's name as parameter
redirect(URL('default', 'payments', vars={'student_name': student_name}))  
  return locals()def payments():student_name = 
request.vars.student_name# Loading student's information from the 
databasestudent = db(db.store_registration.first_name + ' ' + 
db.store_registration.last_name == student_name).select().first()if 
student is None:raise HTTP(404, "Student not found")*
   
* form.vars.student = student.id  # Set the student reference in the 
payment form*


*form = SQLFORM(db.payments)if form.process().accepted:
response.flash = T('Payment details submitted')return locals()*

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3ef0d52f-001d-456a-888b-496f00990e9en%40googlegroups.com.


[web2py] Re: Failing to display details only for member groups

2023-03-30 Thread mostwanted
Worked like a charm, thank you Leonel

On Wednesday, March 29, 2023 at 7:33:49 PM UTC+2 Leonel Câmara wrote:

> The easiest way is to put a common filter in client_order table, do 
> something like this in your models
>
> db.client_order._common_filter = lambda 
> q:(db.client_order.company.belongs(db(db.business.authority==auth.user_id)._select(
> db.business.id)))
>
> This will AND this query to any other query you make on the table.
>
> A quarta-feira, 29 de março de 2023 à(s) 14:00:52 UTC+1, mostwanted 
> escreveu:
>
>> This is supposed to be simple but i'm failing to make it work! If it were 
>> about displaying the 
>>
>> How can I get business owners of businesses listed in the business table 
>> also referenced in clients_order table to view only requested orders of 
>> their businesses in the client_order table? I hope I’m making sense!
>>
>>
>> *MODELS*
>>
>> db.define_table('business',
>> Field('logo', 'upload', label=SPAN('Your company logo')),
>> Field('banner', 'upload', writable=False, readable=False),
>> Field('company_name', ),
>> Field('product', 'reference product',),
>> Field('tel'),
>>
>> Field('authority', 'reference auth_user', 
>> default=auth.user_id, readable=False, writable=False)
>>
>> )
>>
>> db.define_table('client_order',
>> Field('company', 'reference business'),
>> Field('buyer_name', required=True),
>> Field('buyer_contact', required=True),
>> Field('delivery_location', required=True),
>> Field('quoted_item','list:string', required=True),
>> Field('quantities','list:string', required=True),
>> Field('status', requires=IS_IN_SET(['new', 'sent']), 
>> default='new', writable=False, readable=False),
>> Field('the_timestamp', 'datetime', default=request.now, 
>> writable=False),
>> format='%(buyer_name)s')
>>
>>
>> *CONTROLLERS*
>>
>> @auth.requires_login()
>> def wall():
>> # get the business ID for the logged-in user
>> business_id = db.business(authority=auth.user_id)
>>
>> # check if the user has admin rights for the business
>> if not auth.has_membership(role='admin', business=business_id):
>> # if not, redirect them to a page indicating they don't have 
>> access
>> session.flash = 'You do not have permission to access this page'
>> redirect(URL('default', 'index'))
>> # get the client orders for the logged-in user's business
>> details = db(db.client_order.company == business_id).select()
>>
>> return dict(details=details)
>>
>>
>> @auth.requires_membership(role='admin')
>> def show_details():
>> db(db.client_order.id == request.args(0, 
>> cast=int)).update(status='sent')
>> details = db.client_order(request.args(0, cast=int))
>> return dict(details=details)
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7238f35e-5a33-46c2-99bc-f9f1bcc22a9an%40googlegroups.com.


[web2py] Failing to display details only for member groups

2023-03-29 Thread mostwanted
 

This is supposed to be simple but i'm failing to make it work! If it were 
about displaying the 

How can I get business owners of businesses listed in the business table 
also referenced in clients_order table to view only requested orders of 
their businesses in the client_order table? I hope I’m making sense!


*MODELS*

db.define_table('business',
Field('logo', 'upload', label=SPAN('Your company logo')),
Field('banner', 'upload', writable=False, readable=False),
Field('company_name', ),
Field('product', 'reference product',),
Field('tel'),

Field('authority', 'reference auth_user', 
default=auth.user_id, readable=False, writable=False)

)

db.define_table('client_order',
Field('company', 'reference business'),
Field('buyer_name', required=True),
Field('buyer_contact', required=True),
Field('delivery_location', required=True),
Field('quoted_item','list:string', required=True),
Field('quantities','list:string', required=True),
Field('status', requires=IS_IN_SET(['new', 'sent']), 
default='new', writable=False, readable=False),
Field('the_timestamp', 'datetime', default=request.now, 
writable=False),
format='%(buyer_name)s')


*CONTROLLERS*

@auth.requires_login()
def wall():
# get the business ID for the logged-in user
business_id = db.business(authority=auth.user_id)

# check if the user has admin rights for the business
if not auth.has_membership(role='admin', business=business_id):
# if not, redirect them to a page indicating they don't have access
session.flash = 'You do not have permission to access this page'
redirect(URL('default', 'index'))
# get the client orders for the logged-in user's business
details = db(db.client_order.company == business_id).select()

return dict(details=details)


@auth.requires_membership(role='admin')
def show_details():
db(db.client_order.id == request.args(0, 
cast=int)).update(status='sent')
details = db.client_order(request.args(0, cast=int))
return dict(details=details)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c559a6ff-495e-41f2-b822-a2138d363019n%40googlegroups.com.


[web2py] Re: Unable to calculate values of a selected Index

2023-03-29 Thread mostwanted
Thank you

On Wednesday, March 29, 2023 at 11:11:57 AM UTC+2 Leonel Câmara wrote:

> That's a good solution, one has to be careful to remember that javascript 
> is executed in the client and python in the server so basically you should 
> only really use python to give javascript some initial data that it needs-
>
> A quarta-feira, 29 de março de 2023 à(s) 08:38:04 UTC+1, mostwanted 
> escreveu:
>
>> In my head it was all supposed to work...but ultimately this worked 
>> 
>> function calculateSubtotal(input, index) {
>> var price = parseFloat(input.value);
>>* var quantity = 
>> parseInt(input.parentNode.nextElementSibling.innerHTML);*
>> var subtotal = parseFloat(price * quantity);
>> var subtotalElement = document.getElementById("subtotal" + 
>> index);
>> if (price == 0) {
>> // If price is 0, display the hidden span with text "Not 
>> Available" in red
>> subtotalElement.innerHTML = "";
>> var notAvailableSpan = 
>> input.parentNode.previousElementSibling.querySelector("span.hidden");
>> notAvailableSpan.style.display = "inline";
>> subtotalElement.innerHTML = subtotal.toFixed(2);
>>
>> } else {
>> var notAvailableSpan = 
>> input.parentNode.previousElementSibling.querySelector("span.hidden");
>> notAvailableSpan.style.display = "none";
>> subtotalElement.innerHTML = subtotal.toFixed(2);
>> updateGrandTotal()
>> }
>> }
>>
>> On Tuesday, March 28, 2023 at 9:00:35 PM UTC+2 Leonel Câmara wrote:
>>
>>> Looks like you're trying to mix javascript and python code in a quite 
>>> impossible way. Just pass qty instead of index to the function and use that 
>>> as the quantity.   
>>>
>>> A domingo, 26 de março de 2023 à(s) 15:04:29 UTC+1, mostwanted escreveu:
>>>
>>>> I want to be able to calculate subtotal by multiplying quantity and 
>>>> price but I cant because 
>>>> *var quantity = parseInt("{{=details.quantities[index]}}");* in 
>>>> the code below carries the value of 1 and it does not change. Please 
>>>> assist 
>>>> me identify what could be wrong here and how can i rectify it?
>>>>
>>>> *Model:*
>>>> db.define_table('client_order'),
>>>> Field('quoted_item','list:string', required=True),
>>>> Field('quantities','list:string', required=True))
>>>>
>>>> *View:*
>>>> {{for index, (item, qty) in enumerate(zip(details.quoted_item, 
>>>> details.quantities)):}}
>>>> <tr>
>>>> <td>{{=item}}</td>
>>>> <td><input type="text" onchange="calculateSubtotal(this, 
>>>> {{=index}})" /></td>
>>>> <td>{{=qty}}</td>
>>>> <td><span id="subtotal{{=index}}"></span></td>
>>>> </tr>
>>>> {{pass}}
>>>>
>>>> <script>
>>>> function calculateSubtotal(input, index) {
>>>> var price = parseFloat(input.value);
>>>> *var quantity = parseInt("{{=details.quantities[index]}}");*
>>>> var subtotal = parseFloat(price * quantity);
>>>> document.getElementById("subtotal" + index).innerHTML = 
>>>> subtotal.toFixed(2);
>>>> updateGrandTotal();
>>>> console.log(parseFloat("{{=details.quantities[index]}}"));
>>>> }
>>>> 
>>>>
>>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a9ce6e36-b073-4dd6-b154-1d6849abf0d9n%40googlegroups.com.


[web2py] Re: Unable to calculate values of a selected Index

2023-03-29 Thread mostwanted
In my head it was all supposed to work...but ultimately this worked 

function calculateSubtotal(input, index) {
var price = parseFloat(input.value);
   * var quantity = 
parseInt(input.parentNode.nextElementSibling.innerHTML);*
var subtotal = parseFloat(price * quantity);
var subtotalElement = document.getElementById("subtotal" + 
index);
if (price == 0) {
// If price is 0, display the hidden span with text "Not 
Available" in red
subtotalElement.innerHTML = "";
var notAvailableSpan = 
input.parentNode.previousElementSibling.querySelector("span.hidden");
notAvailableSpan.style.display = "inline";
subtotalElement.innerHTML = subtotal.toFixed(2);

} else {
var notAvailableSpan = 
input.parentNode.previousElementSibling.querySelector("span.hidden");
notAvailableSpan.style.display = "none";
subtotalElement.innerHTML = subtotal.toFixed(2);
updateGrandTotal()
}
}

On Tuesday, March 28, 2023 at 9:00:35 PM UTC+2 Leonel Câmara wrote:

> Looks like you're trying to mix javascript and python code in a quite 
> impossible way. Just pass qty instead of index to the function and use that 
> as the quantity.   
>
> A domingo, 26 de março de 2023 à(s) 15:04:29 UTC+1, mostwanted escreveu:
>
>> I want to be able to calculate subtotal by multiplying quantity and price 
>> but I cant because 
>> *var quantity = parseInt("{{=details.quantities[index]}}");* in the 
>> code below carries the value of 1 and it does not change. Please assist me 
>> identify what could be wrong here and how can i rectify it?
>>
>> *Model:*
>> db.define_table('client_order'),
>> Field('quoted_item','list:string', required=True),
>> Field('quantities','list:string', required=True))
>>
>> *View:*
>> {{for index, (item, qty) in enumerate(zip(details.quoted_item, 
>> details.quantities)):}}
>> <tr>
>> <td>{{=item}}</td>
>> <td><input type="text" onchange="calculateSubtotal(this, 
>> {{=index}})" /></td>
>> <td>{{=qty}}</td>
>> <td><span id="subtotal{{=index}}"></span></td>
>> </tr>
>> {{pass}}
>>
>> <script>
>> function calculateSubtotal(input, index) {
>> var price = parseFloat(input.value);
>> *var quantity = parseInt("{{=details.quantities[index]}}");*
>> var subtotal = parseFloat(price * quantity);
>> document.getElementById("subtotal" + index).innerHTML = 
>> subtotal.toFixed(2);
>> updateGrandTotal();
>> console.log(parseFloat("{{=details.quantities[index]}}"));
>> }
>> 
>>
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f689c35f-a268-4e14-afb9-29d295f3cf76n%40googlegroups.com.


[web2py] Unable to calculate values of a selected Index

2023-03-26 Thread mostwanted
I want to be able to calculate subtotal by multiplying quantity and price 
but I cant because 
*var quantity = parseInt("{{=details.quantities[index]}}");* in the 
code below carries the value of 1 and it does not change. Please assist me 
identify what could be wrong here and how can i rectify it?

*Model:*
db.define_table('client_order'),
Field('quoted_item','list:string', required=True),
Field('quantities','list:string', required=True))

*View:*
{{for index, (item, qty) in enumerate(zip(details.quoted_item, 
details.quantities)):}}

{{=item}}

{{=qty}}


{{pass}}


function calculateSubtotal(input, index) {
var price = parseFloat(input.value);
*var quantity = parseInt("{{=details.quantities[index]}}");*
var subtotal = parseFloat(price * quantity);
document.getElementById("subtotal" + index).innerHTML = 
subtotal.toFixed(2);
updateGrandTotal();
console.log(parseFloat("{{=details.quantities[index]}}"));
}


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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f1e82996-a814-43b1-af86-0a3aa55b8808n%40googlegroups.com.


[web2py] json Data from the server not displaying!

2023-03-20 Thread mostwanted
I have data that is in json format from the database, i want to draw a 
graph with data but i'm not sure how to display it in my view in graph 
format using the plotly library. My view code display nothing!

*CONTROLLER*
def dashboard():
call_clicks = db().select(db.dashboard.call_clicks)
social_clicks = db().select(db.dashboard.social_clicks)
profile_views = db().select(db.dashboard.profile_views)
data = {
'call_clicks': [c.call_clicks for c in call_clicks],
'social_clicks': [s.social_clicks for s in social_clicks],
'profile_views': [p.profile_views for p in profile_views]
}
data_json = json.dumps(data)
return dict(data_json=data_json)

*VIEW*
*This code displays nothing*

{{extend 'layout.html'}}


Data



https://cdn.plot.ly/plotly-latest.min.js";>


[web2py] Re: Validator not saving images

2023-03-18 Thread mostwanted
Hey Leonel, thanks for your reply but the above code is still saving empty 
(0byte) images

On Friday, March 17, 2023 at 5:22:07 PM UTC+2 Leonel Câmara wrote:

> What's happening here is that your validator is reading the file and it's 
> not "rewinding" it afterwards so when the next step gets it the file 
> descriptor is at the end of the file hence the ' bytes size.
>
> I would recommend rewriting it to something like this (the important part 
> being the value.file.seek(0)) note that I haven't tested this code at all.
>
> import pytesseract
> from PIL import Image
> from pydal.validators import Validator, ValidationError
>
> class IMG_HAS_TEXT(Validator):
>
> def __init__(self, check_tokens=None, error_message="Image doesn't 
> have the required text"):
> self.error_message = error_message
> self.check_tokens = check_tokens or []
>
> def validate(self, value, record_id=None):
> try:
> image = Image.open(value.file)
> value.file.seek(0)
> text = pytesseract.image_to_string(image).lower()
> if not text or not all(token in text for token in 
> self.check_tokens):
> raise ValidationError(self.translator(self.error_message))
> return value
> except:
> raise ValidationError(self.translator(self.error_message))
>
> class IS_RECEIPT_OR_INVOICE(IMG_HAS_TEXT):
>
> def __init__(self, error_message="The uploaded file is not a receipt 
> or invoice!"):
> self.error_message = error_message
> self.check_tokens = ("receipt", "invoice")
>
>
> A terça-feira, 14 de março de 2023 à(s) 20:55:11 UTC, mostwanted escreveu:
>
>> I have a little problem with my validator code, its saving 0 byte images 
>> and I just don't know why, the value variable is an image that actually 
>> contains an image, I have tested it several times to see what it contains 
>> and its an image but  for some reason when it comes to saving it in the 
>> database it saves an empty image, please assist me where I could be going 
>> wrong. Regards
>>
>> from gluon import *
>> import pytesseract
>> from PIL import Image
>>
>> class IS_RECEIPT_OR_INVOICE(object):
>> def __init__(self, error_message="The uploaded file is not a receipt 
>> or invoice!"):
>> self.error_message = error_message
>>
>> def __call__(self, value):
>> error = None
>> try:
>> image = Image.open(value.file)
>> text = pytesseract.image_to_string(image)
>> if "receipt" not in text.lower() and "invoice" not in 
>> text.lower() and "RECEIPT" not in text and "INVOICE" not in text:
>> error = self.error_message
>> except:
>> error = self.error_message
>> return (value, error)
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d9fab1d2-83df-4f28-9179-61dadbbba347n%40googlegroups.com.


[web2py] Validator not saving images

2023-03-14 Thread mostwanted

I have a little problem with my validator code, its saving 0 byte images 
and I just don't know why, the value variable is an image that actually 
contains an image, I have tested it several times to see what it contains 
and its an image but  for some reason when it comes to saving it in the 
database it saves an empty image, please assist me where I could be going 
wrong. Regards

from gluon import *
import pytesseract
from PIL import Image

class IS_RECEIPT_OR_INVOICE(object):
def __init__(self, error_message="The uploaded file is not a receipt or 
invoice!"):
self.error_message = error_message

def __call__(self, value):
error = None
try:
image = Image.open(value.file)
text = pytesseract.image_to_string(image)
if "receipt" not in text.lower() and "invoice" not in 
text.lower() and "RECEIPT" not in text and "INVOICE" not in text:
error = self.error_message
except:
error = self.error_message
return (value, error)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/36a83aca-5eba-4f2f-88ab-e624012468fen%40googlegroups.com.


[web2py] Re: Changing to hamburger menu at a desired device viewpoint

2022-11-12 Thread mostwanted
Anyone who could be going through my problem this is where i got help

https://coderwall.com/p/wpjw4w/change-the-bootstrap-navbar-breakpoint

Regards;

On Friday, November 11, 2022 at 9:14:45 AM UTC+2 mostwanted wrote:

> Is there a more easier way to change my menu to get displayed as hamburger 
> menu on a devices of certain viewpoints? The nav class which is the menu 
> class is styled  in the bootstrap.min.css file and I am not getting 
> anywhere with it no matter what I try! I wanna invoke the hamburger menu 
> everytime the app is opened in 1024px device like tablets.
>
> Regards
>
> Most
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/591ab463-9c24-47c7-b9de-43cca6f6da9bn%40googlegroups.com.


[web2py] Re: Changing to hamburger menu at a desired device viewpoint

2022-11-12 Thread mostwanted
Anyone who could be going through my problem this is where is found help
https://www.codeply.com/go/bp/120604

Regards

On Friday, November 11, 2022 at 9:14:45 AM UTC+2 mostwanted wrote:

> Is there a more easier way to change my menu to get displayed as hamburger 
> menu on a devices of certain viewpoints? The nav class which is the menu 
> class is styled  in the bootstrap.min.css file and I am not getting 
> anywhere with it no matter what I try! I wanna invoke the hamburger menu 
> everytime the app is opened in 1024px device like tablets.
>
> Regards
>
> Most
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0e7cadf0-5c9f-410c-b91a-01c26aa9ec0dn%40googlegroups.com.


[web2py] Changing to hamburger menu at a desired device viewpoint

2022-11-10 Thread mostwanted
Is there a more easier way to change my menu to get displayed as hamburger 
menu on a devices of certain viewpoints? The nav class which is the menu 
class is styled  in the bootstrap.min.css file and I am not getting 
anywhere with it no matter what I try! I wanna invoke the hamburger menu 
everytime the app is opened in 1024px device like tablets.

Regards

Most

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/214471bb-466e-4da2-a0f9-7d17e43ad8a7n%40googlegroups.com.


[web2py] Re: Custom Login Decorator

2022-09-24 Thread mostwanted
So I was able to figure my problem out thanks to Arglanir. I put in alittle 
effort & I achieved positive results with the code below.

def onetimecode(func):
def wrapper():
details=['not logged', session.logged]
if not request.vars.type or request.vars.type not in details:
redirect(URL('default', 'subscribe'))
else:
return func()
return wrapper

​


On Wednesday, September 21, 2022 at 10:33:45 AM UTC+2 mostwanted wrote:

> *STATEMENT OF THE PROBLEM*
> ​
>
> I have an infinite loop problem that i don't know how to escape so i need 
> help I have never used a decorator before I'm not even sure i fully 
> understand how they work but i have used one & it's giving me a headache. 
>
> I have registration form that's supposed to be protected by a one time 
> code login page that i put inside a decorator trying to simulate 
> *@auth.requires_login()*. The idea is that if the one time code is 
> correct the user should access the registration form but *NEVER* if it's 
> wrong and the user should never be able to bypass the security feature by 
> directly typing the page address in the URL! But now I'm stuck in a loop 
> with a page(one time code page) that keeps calling itself. How can I fix 
> this to get what I want??
> ​
>
> *ONE TIME CODE FORM*
>
> def subscribe():
> key_exists = not db(db.regKeys.regKey == request.vars.regCode).isempty()
> if request.vars.regCode is None:
> message=''
> if key_exists:
> db(db.regKeys.regKey == request.vars.regCode).delete()
> redirect(URL('register_product'))
> if request.vars.regCode is not None and not key_exists:
> message="INCORRECT REG CODE"
> return locals()
>
> ​
> *DECORATOR CODE*
>
> def onetimecode(func):
> def wrapper():
> redirect(URL('default', 'subscribe'))
> return wrapper
>
> ​
> *REGISTRATION FORM WITH THE DECORATOR*
>
> @onetimecodedef register_product():
>  timeout = auth.settings.expiration
>  details=db(db.thirdParty).select()
>  form=SQLFORM(db.black_market2)
>  if form.process().accepted:
>  response.flash=T('Successfully Registered')
>  return locals()
>
> ​
>
>
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ac705f20-d15d-4c52-b1c9-850cf985653dn%40googlegroups.com.


[web2py] Custom Login Decorator

2022-09-21 Thread mostwanted


*STATEMENT OF THE PROBLEM*
​

I have an infinite loop problem that i don't know how to escape so i need 
help I have never used a decorator before I'm not even sure i fully 
understand how they work but i have used one & it's giving me a headache. 

I have registration form that's supposed to be protected by a one time code 
login page that i put inside a decorator trying to simulate 
*@auth.requires_login()*. The idea is that if the one time code is correct 
the user should access the registration form but *NEVER* if it's wrong and 
the user should never be able to bypass the security feature by directly 
typing the page address in the URL! But now I'm stuck in a loop with a 
page(one time code page) that keeps calling itself. How can I fix this to 
get what I want??
​

*ONE TIME CODE FORM*

def subscribe():
key_exists = not db(db.regKeys.regKey == request.vars.regCode).isempty()
if request.vars.regCode is None:
message=''
if key_exists:
db(db.regKeys.regKey == request.vars.regCode).delete()
redirect(URL('register_product'))
if request.vars.regCode is not None and not key_exists:
message="INCORRECT REG CODE"
return locals()

​
*DECORATOR CODE*

def onetimecode(func):
def wrapper():
redirect(URL('default', 'subscribe'))
return wrapper

​
*REGISTRATION FORM WITH THE DECORATOR*

@onetimecodedef register_product():
 timeout = auth.settings.expiration
 details=db(db.thirdParty).select()
 form=SQLFORM(db.black_market2)
 if form.process().accepted:
 response.flash=T('Successfully Registered')
 return locals()

​






-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/11045f13-00c0-4fbf-9d7a-e39349df5057n%40googlegroups.com.


[web2py] Service worker code preventing form submissions

2022-07-27 Thread mostwanted
I have this code below for a service worker, its primary purpose was for it 
to serve an offline page when the user is offline, it works ok as intended 
but the problem its causing now is that its preventing forms from 
submitting & other pages from opening!! Its javascript but i was hoping to 
get help from this platform nonetheless








































*'use strict';var cacheVersion = 1;var currentCache = {  offline: 
'offline-cache' + cacheVersion};const offlineUrl = 
'//off_line';this.addEventListener('install', event => {  event.waitUntil(  
  caches.open(currentCache.offline).then(function(cache) {  return 
cache.addAll([  '/offline_Image.png',  
'/sesoa_banner.png', '/bootstrap.min.css',  
'/web2py-bootstrap3.css',  '/mystyle.css',  offlineUrl  
]);})  );});this.addEventListener('fetch', event => {  // request.mode 
= navigate isn't supported in all browsers  // so include a check for 
Accept: text/html header.  if (event.request.mode === 'navigate' || 
(event.request.method === 'GET' && 
event.request.headers.get('accept').includes('text/html'))) {
event.respondWith(  fetch(event.request.url).catch(error => {  
// Return the offline page  return 
caches.match(offlineUrl);  }));  }else{// Respond 
with everything else if we can
event.respondWith(caches.match(event.request)
.then(function (response) {return response || 
fetch(event.request);}));  }*
});

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/af7c70dc-b0a2-4140-b1ab-0c3ef5476ea3n%40googlegroups.com.


[web2py] Re: App crushed during a web2py upgrade

2022-06-11 Thread mostwanted
It says 
* cannot import name prevent_open_redirect*

under code listing it highlighted the line in red

import re
from gluon.admin import *
from gluon.fileutils import abspath, read_file, write_file
from gluon.utils import web2py_uuid
*from gluon.tools import Config, prevent_open_redirect*
from gluon.compileapp import find_exposed_functions
from glob import glob
from gluon._compat import iteritems, PY2, pickle, xrange, urlopen, to_bytes, 
StringIO, to_native, reload
import gluon.rewrite
On Sunday, June 12, 2022 at 3:02:55 AM UTC+2 snide...@gmail.com wrote:

> On Saturday, June 11, 2022 at 1:11:03 AM UTC-7 mostwanted wrote:
>
>> I was able to resolve the problem, I reloaded the app from my 
>> pythonanywhere account and i was able to access my admin but i still can 
>> not get my callback to work as expected. Can someone please help me! What 
>> am i doing wrong or what do i need to do?! 
>> It says my web2py is upgraded to 2.22.5-stable+timestamp
>>
>> {{=A(company.no_of_ppadb_codes, _href='#', 
>> callback=URL('ppadb_codes.load', args=company.id), target="content", 
>> _class="show_codes")}}
>> 
>>
>>
>
> So now that you can read tickets again, what is the ticket for this one?
>
> /dps
>  
>
>> Regards
>> On Saturday, June 11, 2022 at 9:53:55 AM UTC+2 mostwanted wrote:
>>
>>> I tried to upgrade my app to the latest version because the 
>>> callback{{=A(link, callback=URL())}} functionality kept redirecting instead 
>>> of calling the page to the current page div but it crushed
>>>
>>> When i open my admin gape i get (*Ticket issued: 
>>> admin/41.77.89.202.2022-06-11.07-43-03.e76169bb-1516-4236-ab3b-6ee56ffdda39 
>>> <https://www.sesoa.co.bw/admin/default/ticket/admin/41.77.89.202.2022-06-11.07-43-03.e76169bb-1516-4236-ab3b-6ee56ffdda39>)
>>>  
>>> *which does not lead me anywhere, everytime i click on it it opens 
>>> another page in another tab with the same ticket message, what can i do, 
>>> please help me!!
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/323f74f8-c9b9-4b9a-b146-8799344dc905n%40googlegroups.com.


[web2py] Re: App crushed during a web2py upgrade

2022-06-11 Thread mostwanted
I was able to resolve the problem, I reloaded the app from my 
pythonanywhere account and i was able to access my admin but i still can 
not get my callback to work as expected. Can someone please help me! What 
am i doing wrong or what do i need to do?! 
It says my web2py is upgraded to 2.22.5-stable+timestamp

{{=A(company.no_of_ppadb_codes, _href='#', callback=URL('ppadb_codes.load', 
args=company.id), target="content", _class="show_codes")}}


Regards
On Saturday, June 11, 2022 at 9:53:55 AM UTC+2 mostwanted wrote:

> I tried to upgrade my app to the latest version because the 
> callback{{=A(link, callback=URL())}} functionality kept redirecting instead 
> of calling the page to the current page div but it crushed
>
> When i open my admin gape i get (*Ticket issued: 
> admin/41.77.89.202.2022-06-11.07-43-03.e76169bb-1516-4236-ab3b-6ee56ffdda39 
> <https://www.sesoa.co.bw/admin/default/ticket/admin/41.77.89.202.2022-06-11.07-43-03.e76169bb-1516-4236-ab3b-6ee56ffdda39>)
>  
> *which does not lead me anywhere, everytime i click on it it opens 
> another page in another tab with the same ticket message, what can i do, 
> please help me!!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4a632a51-0ae0-44c9-8e00-7adf980b12e6n%40googlegroups.com.


[web2py] App crushed during a web2py upgrade

2022-06-11 Thread mostwanted
I tried to upgrade my app to the latest version because the 
callback{{=A(link, callback=URL())}} functionality kept redirecting instead 
of calling the page to the current page div but it crushed

When i open my admin gape i get (*Ticket issued: 
admin/41.77.89.202.2022-06-11.07-43-03.e76169bb-1516-4236-ab3b-6ee56ffdda39 
)
 
*which does not lead me anywhere, everytime i click on it it opens another 
page in another tab with the same ticket message, what can i do, please 
help me!!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3ec4926e-7b1b-46ce-ba70-aebe5d3d6248n%40googlegroups.com.


[web2py] Re: calculating sums of a table field when the values are inherited from another table

2022-04-11 Thread mostwanted
Thank you Jim, works

On Monday, April 11, 2022 at 2:07:06 PM UTC+2 Jim S wrote:

> How about this?
>
> *{{total = 0}}*
>
>
> *{{for c in children:}}*
>
>
>
>
> *{{=c.parent.full_names}}{{=c.childs_names}}
> {{=c.policy_cover.policy_name}}
> {{=c.policy_cover.premium}}*
>
>
> *{{total +=c.policy_cover.premium}}{{pass}}*
> **
> **
> *TOTAL PREMIUM: {{=total}}*
> *    *
> **
>
>
> On Monday, April 11, 2022 at 4:56:37 AM UTC-5 mostwanted wrote:
>
>> I have a problem that i'm failing to fix, i want to calculate the sum of 
>> all premiums for all tables in a client's account. A client is paying  
>> insurance for his kids & his parents, i want to display this information in 
>> the view in an html table and be able to calculate his total premium for 
>> both his kids and his parents, the problem is when i try to add them up it 
>> picks up only 1 value from the children's table which is the value last 
>> entered and 1 value in the parents table.
>>
>> When i try *sum_values=db.children.policy_cover.premium.sum() *i get an 
>> error that:
>> * 'Field' object has no attribute 'premium'*
>>
>> *TABLES*
>>
>>
>>
>>
>>
>>
>>
>> *db.define_table('children_policy',Field('policy_name'),  
>>   Field('premium', 'double'),
>> format='%(policy_name)s')db.define_table('client',
>> Field('full_names'),format='%(full_names)s')*
>>
>>
>>
>>
>>
>> *db.define_table('children',Field('parent', 'reference 
>> client'),Field('childs_names'),
>> Field('policy_cover', 'reference children_policy')*
>>
>> *CONTROLLERS*
>>
>>
>>
>>
>> *def index():clients=db(db.client).select()
>> children=db(db.children).select(db.children.ALL)
>> parent=db(db.parent).select(db.parent.ALL)return locals()*
>>
>>
>> *VIEW*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *POLICY OWNERCHILDPOLICY
>> PREMIUM{{for c in children:}}
>> {{=c.parent.full_names}}{{=c.childs_names}}
>> {{=c.policy_cover.policy_name}}
>> {{=c.policy_cover.premium}}
>> {{total=sum(c.policy_cover.premium)}}{{pass}}{{pass}}  
>>   TOTAL PREMIUM:{{=total}}{{pass}}*
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/abfe61bb-df5c-41fb-a64e-72631545fc81n%40googlegroups.com.


[web2py] calculating sums of a table field when the values are inherited from another table

2022-04-11 Thread mostwanted
I have a problem that i'm failing to fix, i want to calculate the sum of 
all premiums for all tables in a client's account. A client is paying  
insurance for his kids & his parents, i want to display this information in 
the view in an html table and be able to calculate his total premium for 
both his kids and his parents, the problem is when i try to add them up it 
picks up only 1 value from the children's table which is the value last 
entered and 1 value in the parents table.

When i try *sum_values=db.children.policy_cover.premium.sum() *i get an 
error that:
* 'Field' object has no attribute 'premium'*

*TABLES*







*db.define_table('children_policy',Field('policy_name'),
Field('premium', 'double'),
format='%(policy_name)s')db.define_table('client',
Field('full_names'),format='%(full_names)s')*





*db.define_table('children',Field('parent', 'reference 
client'),Field('childs_names'),
Field('policy_cover', 'reference children_policy')*

*CONTROLLERS*




*def index():clients=db(db.client).select()
children=db(db.children).select(db.children.ALL)
parent=db(db.parent).select(db.parent.ALL)return locals()*


*VIEW*


















*POLICY OWNERCHILDPOLICY
PREMIUM{{for c in children:}}
{{=c.parent.full_names}}{{=c.childs_names}}
{{=c.policy_cover.policy_name}}
{{=c.policy_cover.premium}}
{{total=sum(c.policy_cover.premium)}}{{pass}}{{pass}}  
  TOTAL PREMIUM:{{=total}}{{pass}}*

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/23dce829-6096-4e43-b883-0f200da2571dn%40googlegroups.com.


[web2py] Re: Grouping information with its client

2022-04-10 Thread mostwanted
I was able to figure this out & this is how i did it:


Owner
Gender
ID Number
Relationship
Policy
Category 1
Category 1 Premium
Category 1 Benefits
Category 2
Category 2 Premium
Category 2 Benefits

{{for nu in nuclear:}}


{{=client_name(nu.client)}}
{{=nu.client.gender}}
{{=nu.client.id_number}}
{{=nu.client.relationship}}
{{=nu.policy_1}}

{{=nu.member_only.package_name}}
{{=nu.member_only.montly_subscription}}
{{=nu.member_only.take_away_package}}

{{=nu.member_and_newclear_family.package_name}}
{{=nu.member_and_newclear_family.montly_subscription}}
{{=nu.member_and_newclear_family.take_away_package}}




{{=client_name(nu.client)}}
{{=nu.spouse_full_name}}
{{=nu.relationship}}
{{=nu.id_number}}


{{for ch in children:}}
{{if ch.client.id==nu.client.id:}}
{{=client_name(ch.client)}}
{{=ch.childs_full_names}}
{{=ch.relationship}}
{{=ch.policyCover.package_name}}
{{=ch.policy_benefit}}
{{pass}}

{{pass}}

{{for pr in parent:}}
{{if pr.client.id==nu.client.id:}}
{{=client_name(pr.client)}}
{{=pr.full_name}}
{{=pr.relationship}}
{{=pr.policy_1}}
{{=pr.parent_policy.package_name}}

{{=pr.parent_policy.montly_subscription}}
{{pass}}

{{pass}}

{{for ex in extended:}}
{{if ex.client.id==nu.client.id:}}
{{=client_name(ex.client)}}
{{=ex.full_names}}
{{=ex.relationship}}
{{=ex.policy_1}}
{{=ex.extended_family.package_name}}

{{=ex.extended_family.montly_subscription}}
{{pass}}

{{pass}}
{{pass}}


currently so far so good
On Saturday, April 9, 2022 at 9:13:03 PM UTC+2 mostwanted wrote:

> Guys i need help here, I have an insurance database that has 3 tables of 
> information that relates to the client (account holder), what i want to do 
> is to be able to group each piece of information according to its owner 
> (account holder) in an html table in the view and not have it mixed up. 
> Have client A details in row 1, client A children details in row 2 and 
> client A parents information in the following row. From there client B and 
> his information in the subsequent rows then client C & so on. How can i 
> achieve this??
>
> *MODELS*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *db.define_table('client',Field('gender', 
> requires=IS_IN_SET(['Mr', 'Mrs', 'Miss'], zero='---Select Gender---')),
> Field('last_name', requires=IS_NOT_EMPTY()),
> Field('first_name', requires=IS_NOT_EMPTY()),
> Field('id_number', requires = IS_MATCH('^\d{9}?$', error_message='An ID 
> Number should have exactly 9 digits')))db.define_table('children',  
>   Field('client', 'reference client', writable=False),
> Field('gender', requires=IS_IN_SET(['Male', 'Female', 'None'], 
> zero='---Select Gender---')),Field('childs_full_names', 
> requires=IS_NOT_EMPTY()),Field('dob', 'date', 
> requires=IS_NOT_EMPTY()),  
>  )db.define_table('parents_and_in_laws',Field('client', 
> 'reference client', writable=False),Field('gender', 
> requires=IS_IN_SET(['Mr', 'Mrs', 'Miss', 'None'], zero='---Select 
> Gender---')),Field('full_name', requires=IS_NOT_EMPTY()),  
>   Field('id_number', requires = IS_MATCH('^\d{9}?$', 
> error_message='An ID Number should have exactly 9 digits')),
> Field('relationship', requires=IS_NOT_EMPTY()))*
>
> *Controller:*
>
>
>
>
>
> *def client_policy_packages():
> nuclear=db(db.newclear_family.).select(db.newclear_family.ALL)
> children=db(db.children).select(db.children.ALL)
> parent=db(db.parents_and_in_laws).select(db.parents_and_in_laws.ALL)
> extended=db(db.extended_family).select(db.extended_family.ALL)return 
> locals()*
>
> *View:*
>
> **
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d0c48240-b7ed-4f8d-8a04-e57d674b179an%40googlegroups.com.


[web2py] Grouping information with its client

2022-04-09 Thread mostwanted
Guys i need help here, I have an insurance database that has 3 tables of 
information that relates to the client (account holder), what i want to do 
is to be able to group each piece of information according to its owner 
(account holder) in an html table in the view and not have it mixed up. 
Have client A details in row 1, client A children details in row 2 and 
client A parents information in the following row. From there client B and 
his information in the subsequent rows then client C & so on. How can i 
achieve this??

*MODELS*


















*db.define_table('client',Field('gender', 
requires=IS_IN_SET(['Mr', 'Mrs', 'Miss'], zero='---Select Gender---')),
Field('last_name', requires=IS_NOT_EMPTY()),
Field('first_name', requires=IS_NOT_EMPTY()),
Field('id_number', requires = IS_MATCH('^\d{9}?$', error_message='An ID 
Number should have exactly 9 digits')))db.define_table('children',  
  Field('client', 'reference client', writable=False),
Field('gender', requires=IS_IN_SET(['Male', 'Female', 'None'], 
zero='---Select Gender---')),Field('childs_full_names', 
requires=IS_NOT_EMPTY()),Field('dob', 'date', 
requires=IS_NOT_EMPTY()),  
 )db.define_table('parents_and_in_laws',Field('client', 
'reference client', writable=False),Field('gender', 
requires=IS_IN_SET(['Mr', 'Mrs', 'Miss', 'None'], zero='---Select 
Gender---')),Field('full_name', requires=IS_NOT_EMPTY()),  
  Field('id_number', requires = IS_MATCH('^\d{9}?$', 
error_message='An ID Number should have exactly 9 digits')),
Field('relationship', requires=IS_NOT_EMPTY()))*

*Controller:*





*def client_policy_packages():
nuclear=db(db.newclear_family.).select(db.newclear_family.ALL)
children=db(db.children).select(db.children.ALL)
parent=db(db.parents_and_in_laws).select(db.parents_and_in_laws.ALL)
extended=db(db.extended_family).select(db.extended_family.ALL)return 
locals()*

*View:*

**

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8851b60f-3ade-415f-a16a-a3ca47ef352an%40googlegroups.com.


[web2py] Re: Creating a sums value from a column on an SQLFORM.grid

2022-04-08 Thread mostwanted
I'm trying this code below & i'm getting * 'Expression' object has no attribute 
'tablename' *   ERROR*, *whats wrong with my code? or What am i missing??




*def payments():payments_sum_field = 
db.payments.amount.sum().with_alias('total')
grid_table=SQLFORM.grid(db.payments, fields=[db.payments.client, 
db.payments.amount, db.payments.recorded,db.payments.recorded_on, 
payments_sum_field])return locals()*

On Thursday, April 7, 2022 at 2:26:48 PM UTC+2 Jim S wrote:

> It looks like there is support for groupby in SQLFORM.grid which is what 
> you'd need to build the proper SQL statement.
>
> I haven't tried this with web2py.  If I were, I'd try adding a groupby 
> clause and a list of fields that include your sum field.  Something like 
> this (not tested)
>
> payments_sum_field = db.payments.amount.sum()
> SQLFORM.grid(db.payments, fields=[db.payments.field_1, 
> db.payments.field_2, payments_sum_field], groupby=[db.payments.field_1, 
> db.payments.field_2])
>
>
> FWIW - I just submitted a PR for py4web to do exactly what you're talking 
> about.  Looking at the code in web2py for groupby I see that I can improve 
> what I'd submitted so far.
>
> -Jim
>
> On Thursday, April 7, 2022 at 3:29:37 AM UTC-5 mostwanted wrote:
>
>> Hi guys, I was wondering if i could create a sums column on an 
>> SQLFORM.grid so that every search that's made produces a sums value, 
>> something like this:
>>
>>
>>
>>
>>
>>
>> *def payments():grid = SQLFORM.grid(db.payments, args=[db.payments])  
>>   if grid.process().accepted:query=("#Search queries of the 
>> SQLFORMgrid")amount = 
>> db(query).select((db.payments.amount).sum().with_alias('total'))return 
>> locals()*
>>
>> Whats possible and whats not?
>>
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1e60c2a0-c3d8-4109-96de-51236f41cc26n%40googlegroups.com.


[web2py] Creating a sums value from a column on an SQLFORM.grid

2022-04-07 Thread mostwanted
Hi guys, I was wondering if i could create a sums column on an SQLFORM.grid 
so that every search that's made produces a sums value, something like this:






*def payments():grid = SQLFORM.grid(db.payments, args=[db.payments])
if grid.process().accepted:query=("#Search queries of the 
SQLFORMgrid")amount = 
db(query).select((db.payments.amount).sum().with_alias('total'))return 
locals()*

Whats possible and whats not?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e3dfb0fc-7b73-4564-bb14-f3d523832438n%40googlegroups.com.


Re: [web2py] Exporting html table as csv

2022-03-30 Thread mostwanted
Its a permanent html table in the view with information from different 
database tables. From there i wanna download it as CSV to be used in excel 
reports.

On Wednesday, March 30, 2022 at 11:10:12 AM UTC+2 snide...@gmail.com wrote:

>
> On Saturday, March 26, 2022 at 2:24:06 AM UTC-7 mostwanted wrote:
>
>> Thanks alot Murat, gratitude
>>
>
> Was 
>  http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV-one-Table-at-a-time-
> >
> of any help?  Are you creating a temporary table that you render the HTML 
> from?
>
>  
>
>>
>> On Friday, March 25, 2022 at 1:05:54 PM UTC+2 muratkas...@gmail.com 
>> wrote:
>>
>>> Hi,
>>>
>>> You can use the javascript on HTML file like this:
>>> https://yourblogcoach.com/export-html-table-to-csv-using-javascript/
>>>
>>> https://stackoverflow.com/questions/15547198/export-html-table-to-csv-using-vanilla-javascript
>>>
>>> If you want to read CSV and insert to db, you can check the codes in 
>>> appadmin.py file on admin app.
>>>
>>> Regards,
>>> Murat.
>>>
>>>
>>>
>>> mostwanted , 25 Mar 2022 Cum, 11:11 tarihinde şunu 
>>> yazdı:
>>>
>>>> Is there a way to download data in my html table as csv? 
>>>>
>>>> I have information in an html table that comes from 4 different 
>>>> database tables but i want to have it downloaded to be used further in 
>>>> excel. Can i download this html table that i have combined all this 
>>>> information in as a single csv file with all this information?
>>>>
>>>> Regards;
>>>>
>>>> /dps
>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/16f85205-ee5a-4702-945d-c0859c1743bbn%40googlegroups.com.


[web2py] Re: Unable to save pdf documents in my app

2022-03-30 Thread mostwanted
Thank you Clemens

On Wednesday, March 30, 2022 at 9:25:13 AM UTC+2 Clemens wrote:

> A few years ago I had to create a directory by web2py. I did it as follows:
> from subprocess import Popen
> ...
> create_dir = Popen(['mkdir', '%s%s' %(destination, build_date.strftime(
> '%Y-%m-%d-%H%M%S'))], stderr=PIPE)
>
> Thus, if the directory is not available you can create it. I guess the 
> return value of Popen will tell you.
>
> Maybe it helps.
>
> Regards
> Clemens
>
> On Tuesday, March 29, 2022 at 8:00:20 AM UTC+2 mostwanted wrote:
>
>> Guys my app suddenly wont save PDF documents.
>>
>>
>> *db.define_table('pdfs',
>> Field('fileS','upload',uploadfolder=request.folder+'static/pdfs')).*
>>
>>  The above code does not create static/pdfs folder as expected so when i 
>> click on the link thats supposed allow me to view the pdf  *{{=A('Click 
>> to view', _href=URL('default', 'viewer'))}} *it get an error *404 NOT 
>> FOUND *
>>
>> Am i missing something or is there a workaround this issue?
>>
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/aa9e67a7-d2cb-4a81-b8af-15eeaad1cf49n%40googlegroups.com.


[web2py] Re: Unable to save pdf documents in my app

2022-03-29 Thread mostwanted
Yes they do

On Wednesday, March 30, 2022 at 4:57:01 AM UTC+2 Jim S wrote:

> Does the user that is running the web2py server have rights to create the 
> directory and files inside that directory?
>
> -Jim
>
>
> On Tuesday, March 29, 2022 at 9:51:42 PM UTC-5 mostwanted wrote:
>
>> Yes it is
>>
>> On Tuesday, March 29, 2022 at 9:41:43 PM UTC+2 Jim S wrote:
>>
>>> I think the folder would be created.  However, the security must be 
>>> setup properly for it to happen.
>>>
>>> Is this on a production box?  Linux?
>>>
>>> -Jim
>>>
>>> On Tuesday, March 29, 2022 at 2:37:23 PM UTC-5 mostwanted wrote:
>>>
>>>> The file exists but only in the database but the folder in static 
>>>> doesnt exist, i thought the folder gets created with the first database 
>>>> entry
>>>>
>>>> On Tuesday, March 29, 2022 at 2:00:18 PM UTC+2 Jim S wrote:
>>>>
>>>>> I would first suspect a security issue.
>>>>>
>>>>> Have you confirmed that the folder exists?  If so, does the file exist?
>>>>>
>>>>> -Jim
>>>>>
>>>>> On Tuesday, March 29, 2022 at 1:07:26 AM UTC-5 mostwanted wrote:
>>>>>
>>>>>> I tried to change this line:
>>>>>> *Field('fileS','upload',uploadfolder=request.folder+'static/pdfs'))*
>>>>>> to this below
>>>>>>
>>>>>> *Field('fileS','upload',uploadfolder=os.path.join(request.folder, 
>>>>>> 'static/profile')) *
>>>>>>
>>>>>> but still nothing works!!!
>>>>>>
>>>>>> On Tuesday, March 29, 2022 at 8:00:20 AM UTC+2 mostwanted wrote:
>>>>>>
>>>>>>> Guys my app suddenly wont save PDF documents.
>>>>>>>
>>>>>>>
>>>>>>> *db.define_table('pdfs',
>>>>>>> Field('fileS','upload',uploadfolder=request.folder+'static/pdfs')).*
>>>>>>>
>>>>>>>  The above code does not create static/pdfs folder as expected so 
>>>>>>> when i click on the link thats supposed allow me to view the pdf  
>>>>>>> *{{=A('Click 
>>>>>>> to view', _href=URL('default', 'viewer'))}} *it get an error *404 
>>>>>>> NOT FOUND *
>>>>>>>
>>>>>>> Am i missing something or is there a workaround this issue?
>>>>>>>
>>>>>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/07196fcf-3643-4bc7-9605-9fbdef72bab8n%40googlegroups.com.


[web2py] Re: Unable to save pdf documents in my app

2022-03-29 Thread mostwanted
Yes it is

On Tuesday, March 29, 2022 at 9:41:43 PM UTC+2 Jim S wrote:

> I think the folder would be created.  However, the security must be setup 
> properly for it to happen.
>
> Is this on a production box?  Linux?
>
> -Jim
>
> On Tuesday, March 29, 2022 at 2:37:23 PM UTC-5 mostwanted wrote:
>
>> The file exists but only in the database but the folder in static doesnt 
>> exist, i thought the folder gets created with the first database entry
>>
>> On Tuesday, March 29, 2022 at 2:00:18 PM UTC+2 Jim S wrote:
>>
>>> I would first suspect a security issue.
>>>
>>> Have you confirmed that the folder exists?  If so, does the file exist?
>>>
>>> -Jim
>>>
>>> On Tuesday, March 29, 2022 at 1:07:26 AM UTC-5 mostwanted wrote:
>>>
>>>> I tried to change this line:
>>>> *Field('fileS','upload',uploadfolder=request.folder+'static/pdfs'))*
>>>> to this below
>>>>
>>>> *Field('fileS','upload',uploadfolder=os.path.join(request.folder, 
>>>> 'static/profile')) *
>>>>
>>>> but still nothing works!!!
>>>>
>>>> On Tuesday, March 29, 2022 at 8:00:20 AM UTC+2 mostwanted wrote:
>>>>
>>>>> Guys my app suddenly wont save PDF documents.
>>>>>
>>>>>
>>>>> *db.define_table('pdfs',
>>>>> Field('fileS','upload',uploadfolder=request.folder+'static/pdfs')).*
>>>>>
>>>>>  The above code does not create static/pdfs folder as expected so when 
>>>>> i click on the link thats supposed allow me to view the pdf  *{{=A('Click 
>>>>> to view', _href=URL('default', 'viewer'))}} *it get an error *404 NOT 
>>>>> FOUND *
>>>>>
>>>>> Am i missing something or is there a workaround this issue?
>>>>>
>>>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/53f1947b-b25b-40d7-b26a-71ca031cf5efn%40googlegroups.com.


[web2py] Re: Unable to save pdf documents in my app

2022-03-29 Thread mostwanted
The file exists but only in the database but the folder in static doesnt 
exist, i thought the folder gets created with the first database entry

On Tuesday, March 29, 2022 at 2:00:18 PM UTC+2 Jim S wrote:

> I would first suspect a security issue.
>
> Have you confirmed that the folder exists?  If so, does the file exist?
>
> -Jim
>
> On Tuesday, March 29, 2022 at 1:07:26 AM UTC-5 mostwanted wrote:
>
>> I tried to change this line:
>> *Field('fileS','upload',uploadfolder=request.folder+'static/pdfs'))*
>> to this below
>>
>> *Field('fileS','upload',uploadfolder=os.path.join(request.folder, 
>> 'static/profile')) *
>>
>> but still nothing works!!!
>>
>> On Tuesday, March 29, 2022 at 8:00:20 AM UTC+2 mostwanted wrote:
>>
>>> Guys my app suddenly wont save PDF documents.
>>>
>>>
>>> *db.define_table('pdfs',
>>> Field('fileS','upload',uploadfolder=request.folder+'static/pdfs')).*
>>>
>>>  The above code does not create static/pdfs folder as expected so when i 
>>> click on the link thats supposed allow me to view the pdf  *{{=A('Click 
>>> to view', _href=URL('default', 'viewer'))}} *it get an error *404 NOT 
>>> FOUND *
>>>
>>> Am i missing something or is there a workaround this issue?
>>>
>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3a76b0a1-048c-4ac9-8e63-f96379c64c6fn%40googlegroups.com.


[web2py] Re: Unable to save pdf documents in my app

2022-03-29 Thread mostwanted
I tried to change this line:
*Field('fileS','upload',uploadfolder=request.folder+'static/pdfs'))*
to this below

*Field('fileS','upload',uploadfolder=os.path.join(request.folder, 
'static/profile')) *

but still nothing works!!!

On Tuesday, March 29, 2022 at 8:00:20 AM UTC+2 mostwanted wrote:

> Guys my app suddenly wont save PDF documents.
>
>
> *db.define_table('pdfs',
> Field('fileS','upload',uploadfolder=request.folder+'static/pdfs')).*
>
>  The above code does not create static/pdfs folder as expected so when i 
> click on the link thats supposed allow me to view the pdf  *{{=A('Click 
> to view', _href=URL('default', 'viewer'))}} *it get an error *404 NOT 
> FOUND *
>
> Am i missing something or is there a workaround this issue?
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/26c9382c-02f8-4e12-a0ed-231ef33bdb92n%40googlegroups.com.


[web2py] Unable to save pdf documents in my app

2022-03-29 Thread mostwanted
Guys my app suddenly wont save PDF documents.


*db.define_table('pdfs',
Field('fileS','upload',uploadfolder=request.folder+'static/pdfs')).*

 The above code does not create static/pdfs folder as expected so when i 
click on the link thats supposed allow me to view the pdf  *{{=A('Click to 
view', _href=URL('default', 'viewer'))}} *it get an error *404 NOT FOUND *


Am i missing something or is there a workaround this issue?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/eb89d9ef-99ac-4029-92f0-94dc45e12cben%40googlegroups.com.


Re: [web2py] Exporting html table as csv

2022-03-26 Thread mostwanted
Thanks alot Murat, gratitude

On Friday, March 25, 2022 at 1:05:54 PM UTC+2 muratkas...@gmail.com wrote:

> Hi,
>
> You can use the javascript on HTML file like this:
> https://yourblogcoach.com/export-html-table-to-csv-using-javascript/
>
> https://stackoverflow.com/questions/15547198/export-html-table-to-csv-using-vanilla-javascript
>
> If you want to read CSV and insert to db, you can check the codes in 
> appadmin.py file on admin app.
>
> Regards,
> Murat.
>
>
>
> mostwanted , 25 Mar 2022 Cum, 11:11 tarihinde şunu 
> yazdı:
>
>> Is there a way to download data in my html table as csv? 
>>
>> I have information in an html table that comes from 4 different database 
>> tables but i want to have it downloaded to be used further in excel. Can i 
>> download this html table that i have combined all this information in as a 
>> single csv file with all this information?
>>
>> 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+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/05b0e270-acc0-4856-a9af-bb2acdf9fe48n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/05b0e270-acc0-4856-a9af-bb2acdf9fe48n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/33af83ae-322f-422f-b0b8-8101f03fdc00n%40googlegroups.com.


[web2py] Exporting html table as csv

2022-03-25 Thread mostwanted
Is there a way to download data in my html table as csv? 

I have information in an html table that comes from 4 different database 
tables but i want to have it downloaded to be used further in excel. Can i 
download this html table that i have combined all this information in as a 
single csv file with all this information?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/05b0e270-acc0-4856-a9af-bb2acdf9fe48n%40googlegroups.com.


[web2py] unable to parse csv file web2py

2022-03-22 Thread mostwanted
Morning guys, I am encountering this issue for the first time today that is 
why i am coming before the forum for clarification. 

I cant use the web2py admin csv upload button because i get a popup that 
says *unable to parse csv file web2py *. I have been researching this issue 
& apparently there are 2 solutions for both python2 & python3, can someone 
please with full clarity show me the solutions that work for both python2 & 
python3?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c0463b43-8ace-4ac3-b283-0b6b8dff5f89n%40googlegroups.com.


[web2py] Re: About migrate and fake_migrate

2022-03-22 Thread mostwanted
Tom Thank you, i will re-read this and come back to it when i encounter one 
of these because they used to taunt me alot, i cant count the number of 
times I deleted & re-created & re-named a table because of this error.

On Wednesday, March 16, 2022 at 10:56:33 AM UTC+2 Tom Clerckx wrote:

> I was a bit confused about the explanation of the fake_migrate option in 
> the web2py documentation. After some experimenting, I wrote up the 
> following information for myself, just sharing it here with you. Maybe 
> someone can merge this information in the web2py documentation, if you 
> think it contributes to making this topic more clear.
> --
>
> The explanation here assumes sqlite as a database, but I believe holds 
> also for other databases.
>
> When changing a model, e.g. adding a field there are two places where 
> information is updated.
>
>- In the database-metadata files. These files are located in the 
>database folder. For each table a metadata file is created. If you want to 
>inspect these files, you can inspect them by unpickling them
>
>
>- In the database.sqlite file. This is the database itself.The new 
>field will be added to the sqlite schema
>
> The database parameter *migrate* (=True by default) pushes changes that 
> are made in your model back into the meta-data file and in the sqlite file.
> Another option *fake_migrate* (=False by default) pushes changes that are 
> made in your model back into the meta-data file, *but not in the sqlite 
> database file.*
> Note also that this option will only push new Fields back into the 
> meta-data file. *It does not remove fields from the metadata file that 
> you may have removed in your model!!*
>
> For each field described in your model (and thus also in the metadata 
> file), you should have a corresponding element in the sqlite schema.
> If that is not the case, you can have one of two errors:
> Error 1: 
> The field is present in the sqlite database, it also exists in your model 
> file, but for some reason it does not exist in the metadata file. Because 
> it is defined in the model and it is not yet present in the metadata file, 
> web2py wants to create it by doing a migrate.
> This migrate, includes updating both the metadata file *and* the sqlite 
> schema. The problem however, is that in the sqlite schema, this field 
> already exists!
> This will cause an error similar as:
> *sqlite3.OperationalError: duplicate column name: blablabla*
> Solution:
> We can fix this by telling web2py to do a 'fake_migrate'.
> This is done by adding the parameter *fake_migrate=True* in the table 
> definition.
> By doing a fake migrate, web2py will only update the metadata file and NOT 
> the sqlite database. As such, the fields in the database and in the 
> metadata file will get back in sync.
> *It is important* to remove the fake_migrate parameter again after the 
> data sources are back in sync!
>
> Error 2: 
> The field is in the metadata file, it also exists in your model file, but 
> for some reason it does not exist in the sqlite schema. Because it is 
> defined in the model and in the metadata file, web2py will try to load this 
> field from the database.
> But because it is not defined in the database, you will get an error such 
> as:
> *sqlite3.OperationalError: no such column: person.blablabla*
> Solution 2:
> In this case we cannot do the fake-migrate directly, because the 
> fake-migrate option can add the new fields to the metadata file, but it 
> won't push the field to the database. So what we should do is:
>
>1. First remove again the field in question from our model.
>2. Set the fake_migrate=True option
>3. Remove the meta-data file (keep a backup of it elsewhere, just to 
>make sure)
>4. Reload the database (e.g. by doing a screen refresh in the page 
>where you use the table in question)... this will recreate the meta-data 
>file based on your current model.
>5. Set fake_migrate=False (or just remove it, as False is the default 
>value)
>6. Put back the field in question in the model 
>7. Reload the database once more
>8. By reloading the database, web2py will now push the new field again 
>in the metadatafile and it will also update the sqlite schema. Now all 
> data 
>is back in sync.
>
>
> Sidenote: Why you should not have fake_migrate=True in a normal situation
> If you would leave fake_migrate=True, you would actually cause Error 2 
> above to happen when you add a new field to your table, because in that 
> case the new field
> is only committed to the metadata-file and not to the sqlite database.
>

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

Re: [web2py] Upgrading to a higher version of web2py through the admin interface

2022-01-18 Thread mostwanted
Thank you guys, I was able to upgrade to version 2.21 & there were no 
issues (smiles)...but i'm still experiencing the problem with my callback 
function 
it is still redirecting  to the url page, what am I doing wrong??!!!

*{{=A("view codes", callback=URL('ppadb_codes.load', args=company.id), 
target="content", _class="show_codes")}}*,  




**


On Wednesday, January 19, 2022 at 7:38:46 AM UTC+2 mauri...@gmail.com wrote:

> I also use pythonannywhere and regularly upgrade with no issues. If being 
> cautious, just backup then upgrade. 
>
> On Wed, Jan 12, 2022, 11:30 AM mostwanted  wrote:
>
>> Hi guys, is it safe to upgrade my version of web2py through the admin 
>> interface? Has anyone tried it & did it work?
>>
>> I have an opp developed in an older version of web2py, some functions are 
>> not working on it like *callback=URL()* but in my research it says the 
>> functionality works well in newer versions, when I try to upgrade there is 
>> a disclaimer that I should do it at my own risk!!!. My app is already 
>> online & being utilised so i dont wanna risk anything thats go mess it up.
>>
>> Regards;[image: Screenshot (81).png]
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/5d61e276-7d68-44b2-8ed0-249ab7cfd6f9n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/5d61e276-7d68-44b2-8ed0-249ab7cfd6f9n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ede1c5f0-eb7b-4b68-b032-1330476a661dn%40googlegroups.com.


[web2py] Upgrading to a higher version of web2py through the admin interface

2022-01-12 Thread mostwanted
Hi guys, is it safe to upgrade my version of web2py through the admin 
interface? Has anyone tried it & did it work?

I have an opp developed in an older version of web2py, some functions are 
not working on it like *callback=URL()* but in my research it says the 
functionality works well in newer versions, when I try to upgrade there is 
a disclaimer that I should do it at my own risk!!!. My app is already 
online & being utilised so i dont wanna risk anything thats go mess it up.

Regards;[image: Screenshot (81).png]

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5d61e276-7d68-44b2-8ed0-249ab7cfd6f9n%40googlegroups.com.


Re: [web2py] (PWA) Send a Subscription information to my Server

2022-01-06 Thread mostwanted
The [target] controller is " save_data ", "func" was is just a mistake I 
made

On Thursday, January 6, 2022 at 10:08:43 AM UTC+2 snide...@gmail.com wrote:

> On Tuesday, January 4, 2022 at 1:44:36 AM UTC-8 mostwanted wrote:
>
>> I tried adding this to my code
>>  
>>
>>
>>
>>
>>
>> *$.ajax({  type: "POST",  url: 
>> "https://www.sesoa.co.bw/init/default/func.html 
>> <https://www.sesoa.co.bw/init/default/func.html>",  data: 
>> JSON.stringify(subscribeOptions)   }).done(function( msg ) {  
>> console.log(msg);  });*
>>
>> when i assign *{{=URL('save_data')}}* to url: I get a 400 BAD REQUEST 
>> error
>> When i assign *"/init/default/func.html" *to url: I get a 500 INTERNAL 
>> SERVER error
>>
>> I dont know what to do anymore
>>
>
> Is your [target] controller function called "save_data"  or "func"?
>
>  For the 500 error, is a ticket generated?  If not, do you have logging 
> enabled?  500s are often the result of an exception.
>
> For the 400, what is the actual URL sent to the server?  Your front end 
> should have logged that.
>
> /dps
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/701e76bc-5be9-4843-aa00-f30abf81a929n%40googlegroups.com.


Re: [web2py] (PWA) Send a Subscription information to my Server

2022-01-04 Thread mostwanted
I tried adding this to my code
 





*$.ajax({  type: "POST",  url: 
"https://www.sesoa.co.bw/init/default/func.html;,  data: 
JSON.stringify(subscribeOptions)   }).done(function( msg ) {  
console.log(msg);  });*

when i assign *{{=URL('save_data')}}* to url: I get a 400 BAD REQUEST error
When i assign *"/init/default/func.html" *to url: I get a 500 INTERNAL 
SERVER error

I dont know what to do anymore

On Monday, January 3, 2022 at 1:30:08 PM UTC+2 muratkas...@gmail.com wrote:

> Hi,
>
> Can you try to change the "body:" with "data:" on the code?
> There is a sample JS code on the page: 
> https://www.digitalocean.com/community/tutorials/submitting-ajax-forms-with-jquery
>
> By the way, it is better to check the JSON object format with 
> https://jsonlint.com/ or similar.
>
> Best,
> Murat.
>
>
> mostwanted , 3 Oca 2022 Pzt, 10:31 tarihinde şunu 
> yazdı:
>
>> Hi guys, I am still in the path of converting my app into a PWA. 
>> After subscribing the user to receive push messages I have to take save 
>> this information to the server into my database & this is where I am 
>> failing, I tried the code below to send the information to a function that 
>> will save into a database but the function is not receiving anything 
>> because i keep getting *TypeError: expected string or buffer *when i try 
>> to read the information.  Is there an easier way to grab information from 
>> JavaScript function as JSON data & send it to the server?
>>
>> *function sendSubscriptionToBackEnd(subscription) {* 
>> * method: 'POST', *
>> *url: "{{=URL(''save_data")}},*
>> * headers: { 'Content-Type': 'application/json' }, *
>> * body: JSON.stringify(subscription) }) *
>> *  .then(function(response) {*
>> *if (!response.ok) {*
>> *throw new Error('Bad status code from server.'); } return 
>> response.json(); }) .then(function(responseData) { if (!(responseData.data 
>> && responseData.data.success)) { throw new Error('Bad response from 
>> server.'); } }); }*
>>
>> 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+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/d287bf6d-df95-47b7-ba3b-4062bc12b772n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/d287bf6d-df95-47b7-ba3b-4062bc12b772n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f1606fe4-c53c-426b-b688-336e45d423b2n%40googlegroups.com.


[web2py] (PWA) Send a Subscription information to my Server

2022-01-02 Thread mostwanted
Hi guys, I am still in the path of converting my app into a PWA. 
After subscribing the user to receive push messages I have to take save 
this information to the server into my database & this is where I am 
failing, I tried the code below to send the information to a function that 
will save into a database but the function is not receiving anything 
because i keep getting *TypeError: expected string or buffer *when i try to 
read the information.  Is there an easier way to grab information from 
JavaScript function as JSON data & send it to the server?

*function sendSubscriptionToBackEnd(subscription) {* 
* method: 'POST', *
*url: "{{=URL(''save_data")}},*
* headers: { 'Content-Type': 'application/json' }, *
* body: JSON.stringify(subscription) }) *
*  .then(function(response) {*
*if (!response.ok) {*
*throw new Error('Bad status code from server.'); } return response.json(); 
}) .then(function(responseData) { if (!(responseData.data && 
responseData.data.success)) { throw new Error('Bad response from server.'); 
} }); }*

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d287bf6d-df95-47b7-ba3b-4062bc12b772n%40googlegroups.com.


Re: [web2py] Re: Error ticket for "admin" when trying to create a view

2021-12-17 Thread mostwanted
This is happening on a live app, its live, hosted on pythonanywhere. I am 
starting to suspect something though, I recently received an email from 
pythonanywhere.com informing me that I should change  the system image of 
my app because my app is running on an old one called "dangermouse", in a 
year's time that system image will be absolute so I was encouraged to use a 
new one & I changed it. But they also warned that  my code might need 
modification to run with the new system image & i am starting to suspect 
that the system image i chose is the one affecting the normal functionality 
of my app Just suspicions because before i changed my system image all 
was good.

On Friday, December 17, 2021 at 2:52:22 PM UTC+2 Jim S wrote:

> Is it possible your were no longer logged in or that you cleared your 
> browser cache before this happened?
>
> Sense really weird. Have you tried with a fresh install of web2py?
>
> Jim
>
> On Fri, Dec 17, 2021, 5:56 AM mostwanted  wrote:
>
>> But that's just the thing, I wasn't trying pass any data, i just trying 
>> to create a new view for a new function In my admin interface, as soon as I 
>> clicked create the error popped up & the view failed to create.
>>
>> On Thursday, December 16, 2021 at 7:31:55 PM UTC+2 Jim S wrote:
>>
>>> Looks like you're passing some data through the request vars and the 
>>> value is Null.  Would need to see more code to be able to help.
>>>
>>> -Jim
>>>
>>> On Wednesday, December 15, 2021 at 12:09:08 AM UTC-6 mostwanted wrote:
>>>
>>>> Hi guys, I'm updating one of my very early projects, I was trying to 
>>>> create a view and I got an error:  Error ticket for "admin", I dont 
>>>> know what's causing it, how do I fix this? Its a new error that I have 
>>>> never encountered before, thats the traceback below. I developed it with  
>>>> Version 2.14.6
>>>>
>>>> Traceback
>>>> Traceback (most recent call last):
>>>> File "/home/sesoa/web2py/gluon/restricted.py", line 227, in restricted
>>>> exec ccode in environment
>>>> File "/home/sesoa/web2py/applications/admin/controllers/default.py" 
>>>> <https://www.sesoa.co.bw/admin/default/edit/admin/controllers/default.py>, 
>>>> line 2000, in 
>>>> File "/home/sesoa/web2py/gluon/globals.py", line 417, in 
>>>> self._caller = lambda f: f()
>>>> File "/home/sesoa/web2py/applications/admin/controllers/default.py" 
>>>> <https://www.sesoa.co.bw/admin/default/edit/admin/controllers/default.py>, 
>>>> line 1484, in create_file
>>>> redirect(request.vars.sender + anchor)
>>>> TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
>>>>
>>> -- 
>> 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/zmRXh10o4Y0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/5491225e-6ed7-4edc-9776-0bed44a99263n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/5491225e-6ed7-4edc-9776-0bed44a99263n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a01d4058-00fc-47e0-87f0-6a2f85551493n%40googlegroups.com.


[web2py] Re: Error ticket for "admin" when trying to create a view

2021-12-17 Thread mostwanted
 Honestly i dont know what to rectify and where because the error is not 
coming from my code. This is function I was trying to create a view for, 
its a simple function





*def sold_companies():details=db(db.sold_company).select()
orgCount=len(details)return locals()*

I have attached the image to the Error snapshot:
[image: Screenshot (79).png]
<https://www.sesoa.co.bw/admin/default/ticket/admin/41.77.89.203.2021-12-17.11-50-47.952e9d4f-bc1f-4fd9-abf5-b266902c89ba#>

On Friday, December 17, 2021 at 1:56:35 PM UTC+2 mostwanted wrote:

> But that's just the thing, I wasn't trying pass any data, i just trying to 
> create a new view for a new function In my admin interface, as soon as I 
> clicked create the error popped up & the view failed to create.
>
> On Thursday, December 16, 2021 at 7:31:55 PM UTC+2 Jim S wrote:
>
>> Looks like you're passing some data through the request vars and the 
>> value is Null.  Would need to see more code to be able to help.
>>
>> -Jim
>>
>> On Wednesday, December 15, 2021 at 12:09:08 AM UTC-6 mostwanted wrote:
>>
>>> Hi guys, I'm updating one of my very early projects, I was trying to 
>>> create a view and I got an error:  Error ticket for "admin", I dont 
>>> know what's causing it, how do I fix this? Its a new error that I have 
>>> never encountered before, thats the traceback below. I developed it with  
>>> Version 2.14.6
>>>
>>> Traceback
>>> Traceback (most recent call last):
>>> File "/home/sesoa/web2py/gluon/restricted.py", line 227, in restricted
>>> exec ccode in environment
>>> File "/home/sesoa/web2py/applications/admin/controllers/default.py" 
>>> <https://www.sesoa.co.bw/admin/default/edit/admin/controllers/default.py>, 
>>> line 2000, in 
>>> File "/home/sesoa/web2py/gluon/globals.py", line 417, in 
>>> self._caller = lambda f: f()
>>> File "/home/sesoa/web2py/applications/admin/controllers/default.py" 
>>> <https://www.sesoa.co.bw/admin/default/edit/admin/controllers/default.py>, 
>>> line 1484, in create_file
>>> redirect(request.vars.sender + anchor)
>>> TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bf426f64-3e10-4cbd-ad6f-737d27e843e6n%40googlegroups.com.


[web2py] Re: Error ticket for "admin" when trying to create a view

2021-12-17 Thread mostwanted
But that's just the thing, I wasn't trying pass any data, i just trying to 
create a new view for a new function In my admin interface, as soon as I 
clicked create the error popped up & the view failed to create.

On Thursday, December 16, 2021 at 7:31:55 PM UTC+2 Jim S wrote:

> Looks like you're passing some data through the request vars and the value 
> is Null.  Would need to see more code to be able to help.
>
> -Jim
>
> On Wednesday, December 15, 2021 at 12:09:08 AM UTC-6 mostwanted wrote:
>
>> Hi guys, I'm updating one of my very early projects, I was trying to 
>> create a view and I got an error:  Error ticket for "admin", I dont know 
>> what's causing it, how do I fix this? Its a new error that I have never 
>> encountered before, thats the traceback below. I developed it with  Version 
>> 2.14.6
>>
>> Traceback
>> Traceback (most recent call last):
>> File "/home/sesoa/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>> File "/home/sesoa/web2py/applications/admin/controllers/default.py" 
>> <https://www.sesoa.co.bw/admin/default/edit/admin/controllers/default.py>, 
>> line 2000, in 
>> File "/home/sesoa/web2py/gluon/globals.py", line 417, in 
>> self._caller = lambda f: f()
>> File "/home/sesoa/web2py/applications/admin/controllers/default.py" 
>> <https://www.sesoa.co.bw/admin/default/edit/admin/controllers/default.py>, 
>> line 1484, in create_file
>> redirect(request.vars.sender + anchor)
>> TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5491225e-6ed7-4edc-9776-0bed44a99263n%40googlegroups.com.


[web2py] Error ticket for "admin" when trying to create a view

2021-12-14 Thread mostwanted
Hi guys, I'm updating one of my very early projects, I was trying to create 
a view and I got an error:  Error ticket for "admin", I dont know what's 
causing it, how do I fix this? Its a new error that I have never 
encountered before, thats the traceback below. I developed it with  Version 
2.14.6

Traceback
Traceback (most recent call last):
File "/home/sesoa/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/sesoa/web2py/applications/admin/controllers/default.py" 
, line 
2000, in 
File "/home/sesoa/web2py/gluon/globals.py", line 417, in 
self._caller = lambda f: f()
File "/home/sesoa/web2py/applications/admin/controllers/default.py" 
, line 
1484, in create_file
redirect(request.vars.sender + anchor)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6da63e41-c45f-47a6-99f3-314c472c20f4n%40googlegroups.com.


[web2py] Re: Keeping track of database entires

2021-12-13 Thread mostwanted
You gave an idea and it seems to be working, below is the code i'm using in 
the view:

{{
for dt in dt:
now_dt=request.now.date()-dt.payment_date
now_dt2=now_dt.days
name=dt.client.parent_name
policy_number=dt.client.policy_number
}}

$(document).ready(function(){
if ({{=now_dt2}} >=60)
{
 $('#expiry').show();
}
});



 
{{=name}} ({{=policy_number}})'s payments are 
behind by {{=now_dt2}} DAYS!!! 

{{pass}}

Thanks alot Clemens

On Monday, December 13, 2021 at 11:55:56 AM UTC+2 Clemens wrote:

> My first thought was to check this when an user has logged in. Having a 
> redirect after login to a controller checking the time, the last payment 
> was made, can then produce a corresponding message.
>
> I googled "web2py redirect after login" and found how to do a redirect 
> after login:
> https://stackoverflow.com/questions/18902549/web2py-redirect-after-login
>
> Is it what you want?
>
> Best regards
> Clemens
>
> On Monday, December 13, 2021 at 6:27:10 AM UTC+1 mostwanted wrote:
>
>> Is there a way of keeping track of table entries? I have to create a 
>> function that shows a pop-up warning when a client has not made payments in 
>> 3 months ,i dont know where to begin, any ideas?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/aeea11f6-cf41-4b54-ac22-161c08e4c456n%40googlegroups.com.


[web2py] Keeping track of database entires

2021-12-12 Thread mostwanted
Is there a way of keeping track of table entries? I have to create a 
function that shows a pop-up warning when a client has not made payments in 
3 months ,i dont know where to begin, any ideas?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4690f1dd-b554-4c22-b2ef-e1ed4784216bn%40googlegroups.com.


[web2py] Re: Creating a validator to limit the number of table entries

2021-12-12 Thread mostwanted
Thank you, really.

On Sunday, December 12, 2021 at 3:46:40 PM UTC+2 Clemens wrote:

> Now parent is a valid row object, that can be referenced by parent.id. If 
> it delivers what you want to, it's fine!
>
> Best regards
> Clemens
>
> On Sunday, December 12, 2021 at 2:42:31 PM UTC+1 mostwanted wrote:
>
>> So i decided to do this & seems to be working, I hope it fall apart, 
>> please advice if i'm wrong. I added the validator function inside the 
>> registration function & called it from the process() function, its working, 
>> i hope it wont fall apart.
>>
>> def registration():
>> parent=db.parent(request.args(0, cast=int))
>> 
>> *def my_validator(form):if db((db.children.id 
>> <http://db.children.id>>0) & (db.children.parent==parent.id 
>> <http://parent.id>)).count() >=4:*
>>
>> *form.errors.children_names=SPAN("The number of children has 
>> exceeded the required number")*
>>
>> db.children.parent.default=parent.id
>> form=SQLFORM(db.children)
>> if form.process(onvalidation=my_validator).accepted:
>> response.flash=T('Client Regitered')
>> return locals()
>>
>> On Sunday, December 12, 2021 at 3:01:37 PM UTC+2 mostwanted wrote:
>>
>>> What I want is to prevent more than 10 entries of children per selected 
>>> parent
>>>
>>> On Sunday, December 12, 2021 at 1:45:31 PM UTC+2 Clemens wrote:
>>>
>>>> Hello!
>>>>
>>>> Your are not referencing the parent table. I think, what you want to 
>>>> address, is as follows:
>>>>  if db((db.*parent*.id>0) & (db.children.parent==parent.id)).count() 
>>>> >=10:
>>>> ...
>>>>
>>>> Then the error should not occur and you are get all parents with more 
>>>> than 10 children.
>>>>
>>>> Regards
>>>> Clemens
>>>>
>>>>
>>>> On Sunday, December 12, 2021 at 9:29:11 AM UTC+1 mostwanted wrote:
>>>>
>>>>> I am trying to create a short validator that limits the number of 
>>>>> children that can be listed under one parent but I'm having a problem 
>>>>> with 
>>>>> the highlighted line because I cant use *parent.id <http://parent.id> 
>>>>> *to specify the selected parent when the parent variable is 
>>>>> referenced outside the validator function. I rightfully get:
>>>>> * global name 'parent' is not defined*
>>>>>
>>>>> Anyone on ideas on how to work around this?
>>>>>
>>>>> def my_validator(form):
>>>>> *if db((db.children.id <http://db.children.id>>0) & 
>>>>> (db.children.parent==parent.id <http://parent.id>)).count() >=10:*
>>>>>   form.errors.children_names=SPAN("The number of children has 
>>>>> exceeded the required number")
>>>>>
>>>>> def registration():
>>>>>* parent=db.parent(request.args(0, cast=int)) #referenced outside 
>>>>> the validator function*
>>>>> db.children.parent.default=parent.id
>>>>> form=SQLFORM(db.children)
>>>>> if form.process(onvalidation=my_validator).accepted:
>>>>> response.flash=T('Client Registered')
>>>>> return locals()
>>>>>
>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9731c098-9619-4ce2-be68-cc11d59eef34n%40googlegroups.com.


[web2py] Re: Creating a validator to limit the number of table entries

2021-12-12 Thread mostwanted
So i decided to do this & seems to be working, I hope it fall apart, please 
advice if i'm wrong. I added the validator function inside the registration 
function & called it from the process() function, its working, i hope it 
wont fall apart.

def registration():
parent=db.parent(request.args(0, cast=int))


*def my_validator(form):if db((db.children.id>0) & 
(db.children.parent==parent.id)).count() >=4:
form.errors.children_names=SPAN("The number of children has exceeded the 
required number")*
db.children.parent.default=parent.id
form=SQLFORM(db.children)
if form.process(onvalidation=my_validator).accepted:
response.flash=T('Client Regitered')
return locals()

On Sunday, December 12, 2021 at 3:01:37 PM UTC+2 mostwanted wrote:

> What I want is to prevent more than 10 entries of children per selected 
> parent
>
> On Sunday, December 12, 2021 at 1:45:31 PM UTC+2 Clemens wrote:
>
>> Hello!
>>
>> Your are not referencing the parent table. I think, what you want to 
>> address, is as follows:
>>  if db((db.*parent*.id>0) & (db.children.parent==parent.id)).count() 
>> >=10:
>> ...
>>
>> Then the error should not occur and you are get all parents with more 
>> than 10 children.
>>
>> Regards
>> Clemens
>>
>>
>> On Sunday, December 12, 2021 at 9:29:11 AM UTC+1 mostwanted wrote:
>>
>>> I am trying to create a short validator that limits the number of 
>>> children that can be listed under one parent but I'm having a problem with 
>>> the highlighted line because I cant use *parent.id <http://parent.id> *to 
>>> specify the selected parent when the parent variable is referenced outside 
>>> the validator function. I rightfully get:
>>> * global name 'parent' is not defined*
>>>
>>> Anyone on ideas on how to work around this?
>>>
>>> def my_validator(form):
>>> *if db((db.children.id <http://db.children.id>>0) & 
>>> (db.children.parent==parent.id <http://parent.id>)).count() >=10:*
>>>   form.errors.children_names=SPAN("The number of children has 
>>> exceeded the required number")
>>>
>>> def registration():
>>>* parent=db.parent(request.args(0, cast=int)) #referenced outside 
>>> the validator function*
>>> db.children.parent.default=parent.id
>>> form=SQLFORM(db.children)
>>> if form.process(onvalidation=my_validator).accepted:
>>> response.flash=T('Client Registered')
>>> return locals()
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0e26149b-13df-4e84-898b-dec0214ef45bn%40googlegroups.com.


[web2py] Re: Creating a validator to limit the number of table entries

2021-12-12 Thread mostwanted
What I want is to prevent more than 10 entries of children per selected 
parent

On Sunday, December 12, 2021 at 1:45:31 PM UTC+2 Clemens wrote:

> Hello!
>
> Your are not referencing the parent table. I think, what you want to 
> address, is as follows:
>  if db((db.*parent*.id>0) & (db.children.parent==parent.id)).count() >=10:
> ...
>
> Then the error should not occur and you are get all parents with more than 
> 10 children.
>
> Regards
> Clemens
>
>
> On Sunday, December 12, 2021 at 9:29:11 AM UTC+1 mostwanted wrote:
>
>> I am trying to create a short validator that limits the number of 
>> children that can be listed under one parent but I'm having a problem with 
>> the highlighted line because I cant use *parent.id <http://parent.id> *to 
>> specify the selected parent when the parent variable is referenced outside 
>> the validator function. I rightfully get:
>> * global name 'parent' is not defined*
>>
>> Anyone on ideas on how to work around this?
>>
>> def my_validator(form):
>> *if db((db.children.id <http://db.children.id>>0) & 
>> (db.children.parent==parent.id <http://parent.id>)).count() >=10:*
>>   form.errors.children_names=SPAN("The number of children has 
>> exceeded the required number")
>>
>> def registration():
>>* parent=db.parent(request.args(0, cast=int)) #referenced outside the 
>> validator function*
>> db.children.parent.default=parent.id
>> form=SQLFORM(db.children)
>> if form.process(onvalidation=my_validator).accepted:
>> response.flash=T('Client Registered')
>> return locals()
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/29e7c1b4-ecd7-424d-8b37-f5cb8baa8d2cn%40googlegroups.com.


[web2py] Creating a validator to limit the number of table entries

2021-12-12 Thread mostwanted
I am trying to create a short validator that limits the number of children 
that can be listed under one parent but I'm having a problem with the 
highlighted line because I cant use *parent.id *to specify the selected 
parent when the parent variable is referenced outside the validator 
function. I rightfully get:
* global name 'parent' is not defined*

Anyone on ideas on how to work around this?

def my_validator(form):
*if db((db.children.id>0) & (db.children.parent==parent.id)).count() 
>=10:*
  form.errors.children_names=SPAN("The number of children has 
exceeded the required number")

def registration():
   * parent=db.parent(request.args(0, cast=int)) #referenced outside the 
validator function*
db.children.parent.default=parent.id
form=SQLFORM(db.children)
if form.process(onvalidation=my_validator).accepted:
response.flash=T('Client Registered')
return locals()

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c46b4101-7d5f-4df7-ab24-88d57772d3afn%40googlegroups.com.


[web2py] Load giving a 404 NOT FOUND

2021-12-10 Thread mostwanted
Why cant i use *details=db.table(request.args(0, cast=int)) *function 
in a load? When i do i get 404 NOT FOUND error, is there  way around this?

function:
def children():
client=db.client(request.args(0, cast=int))
db.children.client.default=client.id
form=SQLFORM(db.children)
if form.process().accepted:
response.flash=T('Family Member Registered')
return locals()

*THE VIEW BELOW DOES NOT OPEN THE FORM, IT GIVES ME A 404 ERROR*
*View*

POLICY FORMS (DO REGISTRATION/S FOR {{=client_name(details)}})



{{loadmsg = SPAN("loading ...", BR(), SPAN(_class="fa 
fa-spinner fa-spin"), _style="font-size:20px;")}}

{{=LOAD(url=URL(r=request, f='children.load'),content=loadmsg, 
ajax=True)}}



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/163f9bdb-69f3-4357-9377-cc0ec4f4acden%40googlegroups.com.


[web2py] LOAD is giving 404 NOT FOUND

2021-12-10 Thread mostwanted
I have forms i'm trying load into another page but i'm getting 
404 NOT FOUND error. I dont know what i'm doing wrong, if anyone can spot 
it please help, thats my code below






















*{{loadmsg = SPAN("loading ...", BR(), 
SPAN(_class="fa fa-spinner fa-spin"), _style="font-size:20px;")}}{{=LOAD(url=URL(r=request, 
f='spouse_details.load'),content=loadmsg, ajax=True)}}{{=LOAD(url=URL(r=request, 
f='children.load'),content=loadmsg, ajax=True)}}  
 {{=LOAD(url=URL(r=request, 
f='parent_and_inlaws_cover.load'),content=loadmsg, ajax=True)}}  
{{=LOAD(url=URL(r=request, 
f='extended_family_cover.load'),content=loadmsg, ajax=True)}}
*

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2149d216-1a48-45a2-93e3-7d42eeed2d8bn%40googlegroups.com.


[web2py] Re: Limiting the number of values that could be input in a form field

2021-12-08 Thread mostwanted
Thanks Clemens this worked:
* Field('id_number', requires = IS_MATCH('^\d{9}?$', 
error_message='An ID Number should have exactly 9 digits')), *

On Wednesday, December 8, 2021 at 9:41:45 PM UTC+2 Clemens wrote:

> The right link to the chapter in the web2py documentation is:
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#IS_MATCH
>
> On Wednesday, December 8, 2021 at 8:35:17 PM UTC+1 Clemens wrote:
>
>> I didn't test it, but this should do the job:
>> requires = IS_MATCH('^\w{1,9}$', error_message='must be 1 to 9 
>> characters/digits')
>>
>> For further information about validators with regular expressions have a 
>> look here:
>> http://web2py.com/book/default/chapter/07?search=formstyle#IS_MATCH
>>
>> On Wednesday, December 8, 2021 at 8:23:01 PM UTC+1 mostwanted wrote:
>>
>>> Is there a validator that could be used to limit the number of values 
>>> that could be submitted in a form field? I want users to input their ID 
>>> numbers but they cant be more than 9 characters, how do i achieve this?
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8da7b091-3719-4152-af0e-61813220bd3cn%40googlegroups.com.


[web2py] IS_NOT_IN_DB( ) exception error

2021-12-08 Thread mostwanted
I'm trying to use the validator IS_NOT_IN_DB( ) but i keep getting the 
error below, what does it mean?

* Validation error, field:policy_N 
* 

MY CODE:
db.define_table('client',
Field('client_name'),
Field('id_number', requires = IS_MATCH('^\d{9}?$', 
error_message='An ID Number should have exactly 9 digits')), 

Field('policy_N'),
Field('date_of_birth', 'date'),
Field('member_only', 'reference 
premium_for_member_only_family_policy'),
format="%(client_name)s"
   )
db.client.policy_N.requires=IS_NOT_IN_DB(db,'db.client'*)*

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d4ea5ecd-851f-4a4e-9d7c-f874f1e14a84n%40googlegroups.com.


[web2py] Limiting the number of values that could be input in a form field

2021-12-08 Thread mostwanted
Is there a validator that could be used to limit the number of values that 
could be submitted in a form field? I want users to input their ID numbers 
but they cant be more than 9 characters, how do i achieve this?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/deaaf00b-90a7-4a63-95d6-1f0aa1015e0cn%40googlegroups.com.


[web2py] Re: Calculations on values extracted from several database tables not displaying some values

2021-11-30 Thread mostwanted
With this approach some variables the become undetectable, I get errors 
that:  * name 'orders' is not defined  *and  
* name 'add_r' is not defined* 

On Tuesday, November 30, 2021 at 5:23:02 PM UTC+2 Jim S wrote:

> It looks to me like your nesting in your template is wrong.  Seems that 
> your {{pass}} statements are not where they should be.  Based on how I'm 
> reading it, you'll only get a total if there are orders for room service.  
> You'll only get room service amounts if there are extra room bookings.
>
> I'd do this:
>
> 
> 
> 
> Quantity
> Description
> Order Price
> Value
> 
> 
> {{for invoice in room:}}
> 
> {{=invoice.No_Days}} (days)
> {{=invoice.Room.Room_Number}}
> BWP {{=invoice.roomAmount}}
> BWP {{=invoice.Amount}}
> 
> 
> {{for add_r in add_room:}}
> 
> {{=add_r.No_Days}} (days)
> {{=add_r.Room.Room_Number}}
> BWP {{=add_r.roomAmount}}
> BWP {{=add_r.Amount}}
> 
> {{pass}}
> 
> {{for orders in room_service:}}
> 
> {{=orders.quantity}}
> {{=orders.client_order}}
> BWP {{=orders.price}}
> BWP {{=orders.totalPrice}}
> 
> {{pass}}
> {{
> #Total Calculations of all services rendered
> tourism_levy=10.00
> 
> total=float(invoice.Amount)+float(add_r.Amount)+float(orders.totalPrice)
> 
> totalPrice=float(invoice.Amount)+float(add_r.Amount)+float(orders.totalPrice)+tourism_levy
> }}
> 
> 
> 
> (Levy EXCLUSIVE)
> Sub-Total:
> BWP {{=total}}
> 
> 
> 
> 
>  Tourism Levy:
> BWP {{=tourism_levy}}
> 
> 
> 
> (Levy INCLUSIVE)
> Total:
> BWP {{=totalPrice}}
> 
> {{pass}}
> 
> 
> 
>
> -Jim
>
> On Tuesday, November 30, 2021 at 12:58:23 AM UTC-6 mostwanted wrote:
>
>> In my Guest House booking system I function that is intended to do 
>> invoice calculations for clients using values from different database 
>> tables & display the information in a table in the view.
>>
>> The problem now is some information is not being displayed in the table 
>> in the view when a client has not ordered some services. E.G; 
>>
>>- When a client books in and just orders meals and does not request 
>>an extra room the meals information does not show in the invoice table 
>> only 
>>the room information displays but the total amount charges are not 
>>displayed. 
>>- When a client books a room and an extra room the total amount 
>>charges are not displayed. 
>>- Only when a client has booked a room, booked an extra room and 
>>ordered meals thats when all the information is displayed in the invoices 
>>including calculations.
>>
>>  I am doing something wrong somewhere in my code but i can not figure it 
>> out. I need assistance.
>>
>> *CONTROLLER:*
>> def viewInvoices():
>> invoice=db.ClientDetails(request.args(0, cast=int))
>> resCompany=db(db.my_company).select()
>> room=db((db.book_client2.ClientDetails==invoice.id) & 
>> (db.book_client2.determinant==1)).select()
>> add_room=db((db.additionalRooms2.book_client==invoice.id) & 
>> (db.additionalRooms2.determinant==1)).select()
>> room_service=db((db.room_service_orders.customer==invoice.id) 
>> &(db.room_service_orders.determinant==1)).select()
>> return locals()
>>
>> *VIEW:*
>> 
>> 
>> 
>> Quantity
>> Description
>> Order Price
>> Value
>> 
>> 
>> **
>> {{for invoice in room:}}
>> {{=invoice.No_Days}} (days)
>> {{=invoice.Room.Room_Number}}
>> BWP {{=invoice.roomAmount}}
>> BWP {{=invoice.Amount}}
>> 
>> 
>> **
>> {{for add_r in add_room:}}
>> {{=add_r.No_Days}} (days)
>> {{=add_r.Room.Room_Number}}
>> BWP {{=add_r.roomAmount}}
>&g

[web2py] Calculations on values extracted from several database tables not displaying some values

2021-11-29 Thread mostwanted
In my Guest House booking system I function that is intended to do invoice 
calculations for clients using values from different database tables & 
display the information in a table in the view.

The problem now is some information is not being displayed in the table in 
the view when a client has not ordered some services. E.G; 

   - When a client books in and just orders meals and does not request an 
   extra room the meals information does not show in the invoice table only 
   the room information displays but the total amount charges are not 
   displayed. 
   - When a client books a room and an extra room the total amount charges 
   are not displayed. 
   - Only when a client has booked a room, booked an extra room and ordered 
   meals thats when all the information is displayed in the invoices including 
   calculations.

 I am doing something wrong somewhere in my code but i can not figure it 
out. I need assistance.

*CONTROLLER:*
def viewInvoices():
invoice=db.ClientDetails(request.args(0, cast=int))
resCompany=db(db.my_company).select()
room=db((db.book_client2.ClientDetails==invoice.id) & 
(db.book_client2.determinant==1)).select()
add_room=db((db.additionalRooms2.book_client==invoice.id) & 
(db.additionalRooms2.determinant==1)).select()
room_service=db((db.room_service_orders.customer==invoice.id) 
&(db.room_service_orders.determinant==1)).select()
return locals()

*VIEW:*



Quantity
Description
Order Price
Value


**
{{for invoice in room:}}
{{=invoice.No_Days}} (days)
{{=invoice.Room.Room_Number}}
BWP {{=invoice.roomAmount}}
BWP {{=invoice.Amount}}


**
{{for add_r in add_room:}}
{{=add_r.No_Days}} (days)
{{=add_r.Room.Room_Number}}
BWP {{=add_r.roomAmount}}
BWP {{=add_r.Amount}}



**
{{for orders in room_service:}}
{{=orders.quantity}}
{{=orders.client_order}}
BWP {{=orders.price}}
BWP {{=orders.totalPrice}}

{{
*#Total Calculations of all services rendered*
  tourism_levy=10.00

total=float(invoice.Amount)+float(add_r.Amount)+float(orders.totalPrice)

totalPrice=float(invoice.Amount)+float(add_r.Amount)+float(orders.totalPrice)+tourism_levy
}}

**
(Levy EXCLUSIVE)Sub-Total:BWP 
{{=total}}


 Tourism Levy: BWP {{=tourism_levy}}


(Levy INCLUSIVE)Total: BWP 
{{=totalPrice}}

  {{pass}}
{{pass}}
{{pass}}




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/40a6b893-19b6-48e4-a112-60024b7c0076n%40googlegroups.com.


[web2py] Re: Displaying database information without repeating details

2021-10-30 Thread mostwanted
Thank you Jim, i'll keep working on it, i'm still struggling with summing 
up quantity sales values for each individual item but i will figure it out. 
Thanks for your help. Gratitude. 

On Thursday, October 28, 2021 at 4:41:30 PM UTC+2 Jim S wrote:

> In that case, then I'd do something like this:
>
> If the product name changes, add a 'total' row showing the totals from the 
> previous product name.
>
> 
> {{last_item_name=[]}}
> {{item_quantity = 0}}
> {{for sales in products:}}
> 
> {{if sales.product.name not in last_item_name:}}
> {{if item_quantity > 0:}}
> 
> 
> 
> {{=item_quantity}}
> {{item_quantity = 0}}
> 
> 
> {{pass}}
> {{=sales.product.name}}
> {{=sales.product.Quantity}}
> {{last_item_name.append(sales.product.name)}}
> {{else:}}
> 
> {{=sales.quantity}}
> {{item_quantity += sales.product.quantity}}
> {{pass}}
> 
> {{pass}}
> 
>
> Again, I think the query will need some work, adding a left join to the 
> product table and setting the sort order properly. Add the left join will 
> then require that you include the table name in your field references in 
> your template.
>
> -Jim
>
> On Thursday, October 28, 2021 at 9:31:09 AM UTC-5 mostwanted wrote:
>
>> I apologize for that, i'm terrible at giving variables, my variable 
>> confuse me at times too, *sales.product.Quantity*  is the initial stock, 
>> its the Quantity in the *Products *table, different from the sold 
>> quantity in the *sales *table (*sales.quantity*)
>>
>> On Thursday, October 28, 2021 at 4:22:15 PM UTC+2 Jim S wrote:
>>
>>> Ok, here is what I would do in my template:
>>>
>>> 
>>> {{last_item_name=[]}}
>>> {{item_quantity = 0}}
>>> {{for sales in products:}}
>>> 
>>> {{if sales.product.name not in last_item_name:}}
>>> {{=sales.product.name}}
>>> {{last_item_name.append(sales.product.name)}}
>>> {{else:}}
>>> 
>>> {{pass}}
>>> {{=sales.product.Quantity}}
>>> {{item_quantity += sales.product.Quantity}}
>>> {{=item_quantity}}
>>> 
>>> {{pass}}
>>> 
>>>
>>> In my controller I'd go another step further and add an orderby to 
>>> ensure all products with the same name are in order and in the order of 
>>> when they were purchased. But, this probably means you need a left join as 
>>> well.
>>>
>>> I started coding this, but then was confused by what your columns are 
>>> supposed to be.  From what I gathered,
>>>
>>> Name
>>> Quantity Sold for this sale
>>> Total quantity so far
>>>
>>> But now I'm not sure I'm right
>>>
>>> What does product.Quantity represent vs sales.quantity?
>>>
>>> -Jim
>>>
>>> On Thursday, October 28, 2021 at 8:57:38 AM UTC-5 mostwanted wrote:
>>>
>>>> Hey Jim, thanks for your proposed solution,it worked as shown below, i 
>>>> hope this is how you imagined it but this works now the problem I still 
>>>> have  imagine is how I do the sum up of all of the item's purchase 
>>>> quantity, how would you go about it:
>>>>
>>>> *CONTROLLER:*
>>>> products=db().select(db.sales.ALL)
>>>>
>>>> *VIEW:*
>>>> 
>>>> $(function() { *//Script to hide the empty rows*
>>>> $("table tr").each(function() {
>>>> var cell = $.trim($(this).find('td').text());
>>>> if (cell.length == 0){console.log('empty');
>>>> $(this).addClass('nodisplay');
>>>> }});});
>>>> 
>>>>
>>>> 
>>>>  {{last_item_name=[]}}
>>>> {{for sales in products:}}
>>>> 
>>>> {{if sales.product.name not in last_item_name:}}
>>>> {{=sales.product.name}}
>>>> {{=sales.product.Quantity}}
>>>> {{=sales.quantity}}
>>>> 
>>>> {{last_item_name.append(sales.product.name)}}
>>>> {{else:}}
>>>>  
>>>> {{pass}}
>>>> {{pass}}
>>>> 
>>>> 

[web2py] Re: Displaying database information without repeating details

2021-10-28 Thread mostwanted
I apologize for that, i'm terrible at giving variables, my variable confuse 
me at times too, *sales.product.Quantity*  is the initial stock, its the 
Quantity in the *Products *table, different from the sold quantity in the 
*sales 
*table (*sales.quantity*)

On Thursday, October 28, 2021 at 4:22:15 PM UTC+2 Jim S wrote:

> Ok, here is what I would do in my template:
>
> 
> {{last_item_name=[]}}
> {{item_quantity = 0}}
> {{for sales in products:}}
> 
> {{if sales.product.name not in last_item_name:}}
> {{=sales.product.name}}
> {{last_item_name.append(sales.product.name)}}
> {{else:}}
> 
> {{pass}}
> {{=sales.product.Quantity}}
> {{item_quantity += sales.product.Quantity}}
> {{=item_quantity}}
> 
> {{pass}}
> 
>
> In my controller I'd go another step further and add an orderby to ensure 
> all products with the same name are in order and in the order of when they 
> were purchased. But, this probably means you need a left join as well.
>
> I started coding this, but then was confused by what your columns are 
> supposed to be.  From what I gathered,
>
> Name
> Quantity Sold for this sale
> Total quantity so far
>
> But now I'm not sure I'm right
>
> What does product.Quantity represent vs sales.quantity?
>
> -Jim
>
> On Thursday, October 28, 2021 at 8:57:38 AM UTC-5 mostwanted wrote:
>
>> Hey Jim, thanks for your proposed solution,it worked as shown below, i 
>> hope this is how you imagined it but this works now the problem I still 
>> have  imagine is how I do the sum up of all of the item's purchase 
>> quantity, how would you go about it:
>>
>> *CONTROLLER:*
>> products=db().select(db.sales.ALL)
>>
>> *VIEW:*
>> 
>> $(function() { *//Script to hide the empty rows*
>> $("table tr").each(function() {
>> var cell = $.trim($(this).find('td').text());
>> if (cell.length == 0){console.log('empty');
>> $(this).addClass('nodisplay');
>> }});});
>> 
>>
>> 
>>  {{last_item_name=[]}}
>> {{for sales in products:}}
>> 
>> {{if sales.product.name not in last_item_name:}}
>> {{=sales.product.name}}
>> {{=sales.product.Quantity}}
>> {{=sales.quantity}}
>> 
>> {{last_item_name.append(sales.product.name)}}
>> {{else:}}
>>  
>> {{pass}}
>> {{pass}}
>> 
>> 
>>
>> On Thursday, October 28, 2021 at 2:01:34 PM UTC+2 Jim S wrote:
>>
>>> In the solution I proposed, I would create a variable in my template and 
>>> sum it as I looped through the records.
>>>
>>> It might help if you showed a visual example of what you're trying to 
>>> accomplish. I may be misunderstanding the question, and if so, giving bad 
>>> advice.
>>>
>>> -Jim
>>>
>>> On Thursday, October 28, 2021 at 4:15:49 AM UTC-5 mostwanted wrote:
>>>
>>>> I am able to group them up using *(groupby) *e.g 
>>>> (*products=db().select(db.sales.ALL, 
>>>> orderby=db.sales.product.name <http://db.sales.product.name>, 
>>>> groupby=db.sales.product.name <http://db.sales.product.name>)*) but 
>>>> now I have a problem calculating the sum of each item's sold quantities.
>>>>
>>>> On Wednesday, October 27, 2021 at 8:27:50 PM UTC+2 Jim S wrote:
>>>>
>>>>> I have done this before, but not using SQLFORM.grid
>>>>>
>>>>> In a nutshell
>>>>>
>>>>> 1. Create table tag
>>>>> 2. create your table header
>>>>> 3. create a temp variable last_item_name and set to None
>>>>> 4. loop through all the data you're going to display
>>>>> 5. in the item_name column, check if the current item name is equal to 
>>>>> last_item_name - if it is, put blanks in that cell, if not, put the item 
>>>>> name
>>>>> 6. set last_item_name = current item name
>>>>>
>>>>> Not pretty or clever, more of a brute force way to get it to work.
>>>>>
>>>>> -Jim
>>>>>
>>>>> On Wednesday, October 27, 2021 at 9:56:28 AM UTC-5 Clemens wrote:
>>>>>
>>>>>> Have a look here:
>>>>>>
&g

[web2py] Re: Displaying database information without repeating details

2021-10-28 Thread mostwanted
Hey Jim, thanks for your proposed solution,it worked as shown below, i hope 
this is how you imagined it but this works now the problem I still have 
 imagine is how I do the sum up of all of the item's purchase 
quantity, how would you go about it:

*CONTROLLER:*
products=db().select(db.sales.ALL)

*VIEW:*

$(function() { *//Script to hide the empty rows*
$("table tr").each(function() {
var cell = $.trim($(this).find('td').text());
if (cell.length == 0){console.log('empty');
$(this).addClass('nodisplay');
}});});



 {{last_item_name=[]}}
{{for sales in products:}}

{{if sales.product.name not in last_item_name:}}
{{=sales.product.name}}
{{=sales.product.Quantity}}
{{=sales.quantity}}

{{last_item_name.append(sales.product.name)}}
{{else:}}
 
{{pass}}
{{pass}}



On Thursday, October 28, 2021 at 2:01:34 PM UTC+2 Jim S wrote:

> In the solution I proposed, I would create a variable in my template and 
> sum it as I looped through the records.
>
> It might help if you showed a visual example of what you're trying to 
> accomplish. I may be misunderstanding the question, and if so, giving bad 
> advice.
>
> -Jim
>
> On Thursday, October 28, 2021 at 4:15:49 AM UTC-5 mostwanted wrote:
>
>> I am able to group them up using *(groupby) *e.g 
>> (*products=db().select(db.sales.ALL, 
>> orderby=db.sales.product.name <http://db.sales.product.name>, 
>> groupby=db.sales.product.name <http://db.sales.product.name>)*) but now 
>> I have a problem calculating the sum of each item's sold quantities.
>>
>> On Wednesday, October 27, 2021 at 8:27:50 PM UTC+2 Jim S wrote:
>>
>>> I have done this before, but not using SQLFORM.grid
>>>
>>> In a nutshell
>>>
>>> 1. Create table tag
>>> 2. create your table header
>>> 3. create a temp variable last_item_name and set to None
>>> 4. loop through all the data you're going to display
>>> 5. in the item_name column, check if the current item name is equal to 
>>> last_item_name - if it is, put blanks in that cell, if not, put the item 
>>> name
>>> 6. set last_item_name = current item name
>>>
>>> Not pretty or clever, more of a brute force way to get it to work.
>>>
>>> -Jim
>>>
>>> On Wednesday, October 27, 2021 at 9:56:28 AM UTC-5 Clemens wrote:
>>>
>>>> Have a look here:
>>>>
>>>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#groupby-having
>>>>
>>>> Combining this with:
>>>>
>>>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum-avg-min-max-and-len
>>>>
>>>> Is it what you need?
>>>>
>>>> Best regards
>>>> Clemens
>>>>
>>>>
>>>> On Wednesday, October 27, 2021 at 4:44:11 PM UTC+2 mostwanted wrote:
>>>>
>>>>> I have a sales database table that records items sold in a store, an 
>>>>> item can appear several times in the table having been sold several times 
>>>>> or in different days. What i wanna do is display this information in an 
>>>>> html table in a view without the item names repeating also with the sold 
>>>>> quantity summed up for every item that appears more than once, how can i 
>>>>> achieve this?
>>>>>
>>>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/fa04c325-2110-4c98-bf04-cbc0f393212cn%40googlegroups.com.


[web2py] Re: Displaying database information without repeating details

2021-10-28 Thread mostwanted
I am able to group them up using *(groupby) *e.g 
(*products=db().select(db.sales.ALL, 
orderby=db.sales.product.name, groupby=db.sales.product.name)*) but now I 
have a problem calculating the sum of each item's sold quantities.

On Wednesday, October 27, 2021 at 8:27:50 PM UTC+2 Jim S wrote:

> I have done this before, but not using SQLFORM.grid
>
> In a nutshell
>
> 1. Create table tag
> 2. create your table header
> 3. create a temp variable last_item_name and set to None
> 4. loop through all the data you're going to display
> 5. in the item_name column, check if the current item name is equal to 
> last_item_name - if it is, put blanks in that cell, if not, put the item 
> name
> 6. set last_item_name = current item name
>
> Not pretty or clever, more of a brute force way to get it to work.
>
> -Jim
>
> On Wednesday, October 27, 2021 at 9:56:28 AM UTC-5 Clemens wrote:
>
>> Have a look here:
>>
>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#groupby-having
>>
>> Combining this with:
>>
>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum-avg-min-max-and-len
>>
>> Is it what you need?
>>
>> Best regards
>> Clemens
>>
>>
>> On Wednesday, October 27, 2021 at 4:44:11 PM UTC+2 mostwanted wrote:
>>
>>> I have a sales database table that records items sold in a store, an 
>>> item can appear several times in the table having been sold several times 
>>> or in different days. What i wanna do is display this information in an 
>>> html table in a view without the item names repeating also with the sold 
>>> quantity summed up for every item that appears more than once, how can i 
>>> achieve this?
>>>
>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/313a1e44-7044-4cd9-b603-d0659c73b04dn%40googlegroups.com.


[web2py] Displaying database information without repeating details

2021-10-27 Thread mostwanted
I have a sales database table that records items sold in a store, an item 
can appear several times in the table having been sold several times or in 
different days. What i wanna do is display this information in an html 
table in a view without the item names repeating also with the sold 
quantity summed up for every item that appears more than once, how can i 
achieve this?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/473957e4-4c16-482d-80f8-63ee55e07e9en%40googlegroups.com.


[web2py] Hiding details from view without deleting them from a database when certain condition is satisfied

2021-10-11 Thread mostwanted
Hi guys, I need help achieving a certain task, I have a system which 
creates credit accounts for clients, this information is displayed in a 
view called *credit_details *, what I want is for this information to stop 
displaying once the customer has paid all of their credit but without 
deleting the credit information from the *credit_info and  credit_invoice 
*tables, 
that information is vital for some accounting calculations, how can achieve 
this task?

*CONTROLLER*
def credit_details():
session.details=db.Client_Details(request.args(0, cast=int))
resCompany=db(db.resident_company).select()
db.credit_info.customer.default=session.details.id
form=SQLFORM(db.credit_info)
if form.process().accepted:
response.flash=T('Payment Made')
return locals()

def credit_calculations():
customer=db(db.credit_info.customer==session.details.id).select()
  
payment=db(db.credit_info.customer==session.details.id).select(db.credit_info.amount_paid.sum().with_alias('payment_total'))

total_amount=db(db.credit_invoice.customer==session.details.id).select(db.credit_invoice.Amount.sum().with_alias('total'))
return locals()

*VIEW*

AMOUNT PAID
ATTENDED BY
DATE & TIME
  {{for customer in customer:}}

{{=MoneyFormat(customer.amount_paid)}}
{{=customer.attended_by.first_name}} 
{{=customer.attended_by.last_name}}
{{=customer.paid_on}}

{{pass}}


{{for total_amount in total_amount:
if total_amount.total is None:
total_amount.total=0
}}
 THIS 
CLIENT HAS NO CREDIT!!!

{{pass}}

 CREDIT DUE: {{=MoneyFormat(total_amount.total)}}

{{for payment in payment:}}
{{if payment.payment_total is None:}}
{{payment.payment_total=0}}
CREDIT BALANCE AFTER PAYMENTS: 
{{=MoneyFormat(total_amount.total-payment.payment_total)}}
TOTAL AMOUNT PAID THUS FAR: 
{{=MoneyFormat(payment.payment_total)}}
 No Payment Made Yet!


{{else:}}
 CREDIT BALANCE AFTER PAYMENTS: 
{{=MoneyFormat(total_amount.total-payment.payment_total)}}
TOTAL AMOUNT PAID THUS FAR: 
{{=MoneyFormat(payment.payment_total)}}
{{pass}}
{{pass}}
{{pass}}
{{pass}}

 


$('document').ready(function(){
$(".delete").click(function(){
   return confirm('Are you sure you want to clear this CLIENT?!');
});
});

Clear Client From Credit

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6e268345-5965-4b6a-8fac-dd24ed3a16c2n%40googlegroups.com.


[web2py] Can I create check boxes for IS_IN_DB() validator drop down menu?

2021-02-18 Thread mostwanted
Hi guys, I was wondering if there is a way to create checkboxes for the 
IS_IN_DB() validator & be able to select several options at a go like I can 
with IS_IN_SET().

*Example:*

db.define_table('favourites',
Field('snack'),
format="%(snack)s")

db.define_table('person',
Field('Name'),
Field('favourites', 'reference favourites', 
requires=IS_IN_DB((db, db.favourites, '%(snack)s'),multiple=True), 
widget=SQLFORM.widgets.checkboxes.widget))

If the above is not possible what can i do to achieve the same results?

Regrads,

Mostwanted

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/40cb06ff-0a0a-4bc7-b04d-83294e86b6f0n%40googlegroups.com.


Re: [web2py] Re: Push Notifications

2020-11-20 Thread mostwanted
Gratitude

On Friday, November 20, 2020 at 10:33:10 AM UTC+2 Ramos wrote:

> create a module inside web2py
> API_Pusher.py
>
> import pusher
>
> def pusher_client():
> return pusher.Pusher(
>   app_id='yourid',
>   key='yourkey',
>   secret='yoursecret',
>   cluster='eu',
>   ssl=True
> )
>
>
> Then inside your controllers
>
> from API_Pusher import pusher_client
> ...
> pusher_client().trigger('fileit', 'plannerPesos',  {'message': 
> "PlaySound('ok')"})
>
> Em sex., 20 de nov. de 2020 às 07:41, mostwanted  
> escreveu:
>
>> Hey Ramos, I was able to successfully register the app on pusher.com. 
>> towards step 4 its says i should copy this code:
>> *CODE:*
>> curl -H "Content-Type: application/json" \
>>  -H "Authorization: Bearer 
>> 9C9232906DFC6C8F8115926CC30D637945EB75F60467DA77977C399C4235E61C" \
>>  -X POST "
>> https://733e2240-aca0-4a12-a5a9-c3b1422b9063.pushnotifications.pusher.com/publish_api/v1/instances/733e2240-aca0-4a12-a5a9-c3b1422b9063/publishes;
>>  
>> \
>>  -d 
>> '{"interests":["hello"],"web":{"notification":{"title":"Hello","body":"Hello,
>>  
>> world!"}}}'
>>
>> to my console! Which console is this one? My desktop console? I'm hosted 
>> with pythonanywhere.com, can i use the Bash console in my dashboard?
>>
>> On Tuesday, November 17, 2020 at 7:53:20 AM UTC+2 mostwanted wrote:
>>
>>> Thanks alot Ramos, think this will work, very little work needs to be 
>>> done here, I'll try it out.
>>>
>>> On Tuesday, November 17, 2020 at 1:06:10 AM UTC+2 Ramos wrote:
>>>
>>>> Why reiventing the wheel ??? 
>>>> https://pusher.com/
>>>>
>>>> I use it with web2py and works like a charm
>>>>
>>>>
>>>> Em seg., 16 de nov. de 2020 às 08:44, mostwanted  
>>>> escreveu:
>>>>
>>>>> So far all I have been able achieve is asking the user for permission 
>>>>> to send them notifications & if they accept all that happens is that 
>>>>> everytime they open the app they get a greetings notification, achieving 
>>>>> that was not complicated because it was straight forward, I placed the 
>>>>> code 
>>>>> in my main.js script & it runs everytime the service worker gets 
>>>>> registered.
>>>>>
>>>>> *CODE:*
>>>>> Notification.requestPermission(result => {
>>>>>   if (result === 'granted') {
>>>>> showNotification('Welcome to My App™', 'Everything Services™')
>>>>>   }
>>>>> });
>>>>>
>>>>> function showNotification(title, message) {
>>>>>   if ('Notification' in window) {
>>>>> navigator.serviceWorker.ready.then(registration => {
>>>>>   registration.showNotification(title, {
>>>>> body: message,
>>>>> tag: 'my-app',
>>>>> icon:'/init/static/images/icon_192x192.png',
>>>>> badge:'/init/static/images/icon_128x128.png',
>>>>> vibrate: [200, 100, 200, 100, 200, 100]
>>>>>   });
>>>>> });
>>>>>   }
>>>>> }
>>>>>
>>>>>
>>>>> On Monday, November 16, 2020 at 10:31:10 AM UTC+2 mostwanted wrote:
>>>>>
>>>>>>
>>>>>> Has anyone been able to implement push notifications on their web2py 
>>>>>> apps? 
>>>>>>
>>>>>> I need a working application with some examples on how to implement 
>>>>>> this for one of my applications.
>>>>>>
>>>>>> I've been looking at the "web-push-book (
>>>>>> https://web-push-book.gauntface.com/how-push-works/)" but I cant put 
>>>>>> it together in my head.
>>>>>>
>>>>>> What I wanna achieve is relatively basic, I have an applivcation that 
>>>>>> offers information on services & products sold in my area, so what I 
>>>>>> want 
>>>>>> is to be able to send notifications everytime a new service or product 
>>>>>> is 
>>>>>> re

Re: [web2py] Re: Push Notifications

2020-11-19 Thread mostwanted
Hey Ramos, I was able to successfully register the app on pusher.com. 
towards step 4 its says i should copy this code:
*CODE:*
curl -H "Content-Type: application/json" \
 -H "Authorization: Bearer 
9C9232906DFC6C8F8115926CC30D637945EB75F60467DA77977C399C4235E61C" \
 -X POST 
"https://733e2240-aca0-4a12-a5a9-c3b1422b9063.pushnotifications.pusher.com/publish_api/v1/instances/733e2240-aca0-4a12-a5a9-c3b1422b9063/publishes;
 
\
 -d 
'{"interests":["hello"],"web":{"notification":{"title":"Hello","body":"Hello, 
world!"}}}'

to my console! Which console is this one? My desktop console? I'm hosted 
with pythonanywhere.com, can i use the Bash console in my dashboard?

On Tuesday, November 17, 2020 at 7:53:20 AM UTC+2 mostwanted wrote:

> Thanks alot Ramos, think this will work, very little work needs to be done 
> here, I'll try it out.
>
> On Tuesday, November 17, 2020 at 1:06:10 AM UTC+2 Ramos wrote:
>
>> Why reiventing the wheel ??? 
>> https://pusher.com/
>>
>> I use it with web2py and works like a charm
>>
>>
>> Em seg., 16 de nov. de 2020 às 08:44, mostwanted  
>> escreveu:
>>
>>> So far all I have been able achieve is asking the user for permission to 
>>> send them notifications & if they accept all that happens is that everytime 
>>> they open the app they get a greetings notification, achieving that was not 
>>> complicated because it was straight forward, I placed the code in my 
>>> main.js script & it runs everytime the service worker gets registered.
>>>
>>> *CODE:*
>>> Notification.requestPermission(result => {
>>>   if (result === 'granted') {
>>> showNotification('Welcome to My App™', 'Everything Services™')
>>>   }
>>> });
>>>
>>> function showNotification(title, message) {
>>>   if ('Notification' in window) {
>>> navigator.serviceWorker.ready.then(registration => {
>>>   registration.showNotification(title, {
>>> body: message,
>>> tag: 'my-app',
>>> icon:'/init/static/images/icon_192x192.png',
>>> badge:'/init/static/images/icon_128x128.png',
>>> vibrate: [200, 100, 200, 100, 200, 100]
>>>   });
>>> });
>>>   }
>>> }
>>>
>>>
>>> On Monday, November 16, 2020 at 10:31:10 AM UTC+2 mostwanted wrote:
>>>
>>>>
>>>> Has anyone been able to implement push notifications on their web2py 
>>>> apps? 
>>>>
>>>> I need a working application with some examples on how to implement 
>>>> this for one of my applications.
>>>>
>>>> I've been looking at the "web-push-book (
>>>> https://web-push-book.gauntface.com/how-push-works/)" but I cant put 
>>>> it together in my head.
>>>>
>>>> What I wanna achieve is relatively basic, I have an applivcation that 
>>>> offers information on services & products sold in my area, so what I want 
>>>> is to be able to send notifications everytime a new service or product is 
>>>> registered.
>>>>
>>>> If anyone has any idea on how I can easily implement this please help 
>>>> me.
>>>>
>>>> Regards;
>>>>
>>>> Mostwanted
>>>>
>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/web2py/01da1065-f7d3-4394-9014-a424639bef03n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/web2py/01da1065-f7d3-4394-9014-a424639bef03n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ca28be9e-6720-4993-9f68-1a42cf57a2c1n%40googlegroups.com.


[web2py] Network Protocol Violation Error on my web2py apps

2020-11-16 Thread mostwanted

Guys lately my applications have been experiencing this error when opening:


*The site at https://www.this_site.com/init/default/business_registration 
has experienced a network protocol violation that cannot be repaired. *

This error shows in pages where users have to login, also forms do not 
submit details after being filled up! Is it just me or others are 
experiencing the same thing? Is there is something wrong in my code that 
needs to be fixed? 

Regards;

Mostwanted

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8b0d767a-df9c-4e2b-afa1-82cb42571087n%40googlegroups.com.


Re: [web2py] Re: Push Notifications

2020-11-16 Thread mostwanted
Thanks alot Ramos, think this will work, very little work needs to be done 
here, I'll try it out.

On Tuesday, November 17, 2020 at 1:06:10 AM UTC+2 Ramos wrote:

> Why reiventing the wheel ??? 
> https://pusher.com/
>
> I use it with web2py and works like a charm
>
>
> Em seg., 16 de nov. de 2020 às 08:44, mostwanted  
> escreveu:
>
>> So far all I have been able achieve is asking the user for permission to 
>> send them notifications & if they accept all that happens is that everytime 
>> they open the app they get a greetings notification, achieving that was not 
>> complicated because it was straight forward, I placed the code in my 
>> main.js script & it runs everytime the service worker gets registered.
>>
>> *CODE:*
>> Notification.requestPermission(result => {
>>   if (result === 'granted') {
>> showNotification('Welcome to My App™', 'Everything Services™')
>>   }
>> });
>>
>> function showNotification(title, message) {
>>   if ('Notification' in window) {
>> navigator.serviceWorker.ready.then(registration => {
>>   registration.showNotification(title, {
>> body: message,
>> tag: 'my-app',
>> icon:'/init/static/images/icon_192x192.png',
>> badge:'/init/static/images/icon_128x128.png',
>> vibrate: [200, 100, 200, 100, 200, 100]
>>   });
>> });
>>   }
>> }
>>
>>
>> On Monday, November 16, 2020 at 10:31:10 AM UTC+2 mostwanted wrote:
>>
>>>
>>> Has anyone been able to implement push notifications on their web2py 
>>> apps? 
>>>
>>> I need a working application with some examples on how to implement this 
>>> for one of my applications.
>>>
>>> I've been looking at the "web-push-book (
>>> https://web-push-book.gauntface.com/how-push-works/)" but I cant put it 
>>> together in my head.
>>>
>>> What I wanna achieve is relatively basic, I have an applivcation that 
>>> offers information on services & products sold in my area, so what I want 
>>> is to be able to send notifications everytime a new service or product is 
>>> registered.
>>>
>>> If anyone has any idea on how I can easily implement this please help me.
>>>
>>> Regards;
>>>
>>> Mostwanted
>>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/01da1065-f7d3-4394-9014-a424639bef03n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/01da1065-f7d3-4394-9014-a424639bef03n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/df9d944b-aecc-493d-91a9-b0802987d752n%40googlegroups.com.


[web2py] Re: Push Notifications

2020-11-16 Thread mostwanted
So far all I have been able achieve is asking the user for permission to 
send them notifications & if they accept all that happens is that everytime 
they open the app they get a greetings notification, achieving that was not 
complicated because it was straight forward, I placed the code in my 
main.js script & it runs everytime the service worker gets registered.

*CODE:*
Notification.requestPermission(result => {
  if (result === 'granted') {
showNotification('Welcome to My App™', 'Everything Services™')
  }
});

function showNotification(title, message) {
  if ('Notification' in window) {
navigator.serviceWorker.ready.then(registration => {
  registration.showNotification(title, {
body: message,
tag: 'my-app',
icon:'/init/static/images/icon_192x192.png',
badge:'/init/static/images/icon_128x128.png',
vibrate: [200, 100, 200, 100, 200, 100]
  });
});
  }
}


On Monday, November 16, 2020 at 10:31:10 AM UTC+2 mostwanted wrote:

>
> Has anyone been able to implement push notifications on their web2py apps? 
>
> I need a working application with some examples on how to implement this 
> for one of my applications.
>
> I've been looking at the "web-push-book (
> https://web-push-book.gauntface.com/how-push-works/)" but I cant put it 
> together in my head.
>
> What I wanna achieve is relatively basic, I have an applivcation that 
> offers information on services & products sold in my area, so what I want 
> is to be able to send notifications everytime a new service or product is 
> registered.
>
> If anyone has any idea on how I can easily implement this please help me.
>
> Regards;
>
> Mostwanted
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/01da1065-f7d3-4394-9014-a424639bef03n%40googlegroups.com.


[web2py] Push Notifications

2020-11-16 Thread mostwanted

Has anyone been able to implement push notifications on their web2py apps? 

I need a working application with some examples on how to implement this 
for one of my applications.

I've been looking at the "web-push-book (
https://web-push-book.gauntface.com/how-push-works/)" but I cant put it 
together in my head.

What I wanna achieve is relatively basic, I have an applivcation that 
offers information on services & products sold in my area, so what I want 
is to be able to send notifications everytime a new service or product is 
registered.

If anyone has any idea on how I can easily implement this please help me.

Regards;

Mostwanted

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/34bc7771-9a47-44c5-86f6-5278eded59f7n%40googlegroups.com.


[web2py] Push Notifications

2020-11-16 Thread mostwanted
Has anyone been able to implement push notifications on their web2py apps? 

I need a working application with some examples on how to implement this 
for one of my applications.

I've been looking at the "web-push-book 
(https://web-push-book.gauntface.com/how-push-works/)" but I cant put it 
together in my head.

If anyone has any idea on how I can easily implement this please help me.

Regards;

Mostwanted

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/839ec8da-c37a-473b-899b-0ae9c1d95e51n%40googlegroups.com.


Re: [web2py] Displaying content based on the id attribute

2020-11-10 Thread mostwanted
Oh ok, that makes sense, that could've worked

On Monday, November 9, 2020 at 4:37:52 PM UTC+2 roge...@gmail.com wrote:

> That was a long thread which I didn't read fully. But what I did read made 
> me think that maybe the original problem was that you needed a slight delay 
> between when you showed the span and when you made the ajax call. I do that 
> by putting the ajax call in a setTimeout function. If I don't, the screen 
> doesn't update until the ajax call is completed. 
>
> On Tue, 3 Nov 2020, 7:36 pm mostwanted,  wrote:
>
>> I have a hidden span that i want displayed when a link is clisked while 
>> waiting for the page to load but this is not working! I dont know where I 
>> am going wrong but thought I had it right, please assist me.
>>
>> *CSS:*
>> .link_loader
>> {
>> display: none;
>> }
>>
>> *CONTROLLER*
>> *#The yellow line is the hidden span that has the loader I want to 
>> display*
>> def ajaxlivesearch():
>> keywords = request.vars.keywords
>> print "Keywords: " + str(keywords)
>>
>> if keywords:
>> query = reduce(lambda 
>> a,b:a,[db.services.service_name.contains(k) for k in keywords.split()])
>> services = db(query).select()
>> items = []
>>
>> if services:
>> for c in services: 
>> items.append(DIV*(SPAN("loading ...", SPAN(_class="fa 
>> fa-spinner fa-spin"), _class="link_loader", 
>> data={'id':"res%s"%c.service_name})*, A(c.service_name, 
>> _class="service", _style="font-weight: bold;", _href=URL('companies', args=
>> c.id), _id="res%s"%c.service_name, 
>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name)))
>>
>> *VIEW*
>> *#This jQuery script attempts to display the hidden span*
>>
>> **$(document).ready(function(){
>> $('.service').click(function(e) {
>> const id = $(this).data('id'); 
>> $('#' + id).fadeIn(); 
>> e.preventDefault();
>>
>> });
>> });
>>
>> **
>>
>> Regards;
>>
>> Mostwanted
>>
>> -- 
>>
> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/3b8a175c-ecdc-47e5-a157-45e7fe260f9fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/3b8a175c-ecdc-47e5-a157-45e7fe260f9fn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2db8f2a3-9c4d-44cf-b466-b70b84b761b4n%40googlegroups.com.


Re: [web2py] Re: Displaying content based on the id attribute

2020-11-09 Thread mostwanted
So Jim i've decided to take a different approach with my code because my 
initial approach is giving me a headache. 
I got rid of this function below:









*$(document).ready(function(){
$('a.service').on("click",function() {const id = 
$(this).attr('id'); // Extract the data-id attribute of the link.
$(data('id')==id).fadeIn(); // Select the contact with that id.
//e.preventDefault();   });});*
& decided to have every link display a loading image upon clicking them so 
that my PWA application can have a way of showing the user that the link 
they clicked is in the progress of opening a new page so I implemented this 
function below: 

**









*$(function(){  $('#loading').css('display', 'none');   
$("a:not([href*='#'])").on('click', function(e) {   var link 
=$(this).attr('href');  $('#loading').css('display', 
'inline');   window.location.href=link;   
e.preventDefault();   });  });*
**



*{{=SPAN("loading ...", SPAN(_class="fa fa-spinner 
fa-spin"), _id="loading-image")}}   Can you test that?
>
> Jim
>
>
> On Sat, Nov 7, 2020, 10:30 PM mostwanted  wrote:
>
>> I dont think i wrote this  *$(data('id') == id)* properly but data('id') 
>> is supposed to return the data-id attribute of the hidden span i'm trying 
>> to show
>>
>> On Saturday, November 7, 2020 at 10:32:53 PM UTC+2 Jim S wrote:
>>
>>> I'm confused by this:
>>>
>>> $(data('id') == id).fadeIn(); // Select the contact with that id.
>>>
>>> What is data('id') supposed to return?
>>>
>>> Or is this some jquery thing I'm not aware of?
>>>
>>> -Jim
>>>
>>> On Saturday, November 7, 2020 at 1:57:01 PM UTC-6, mostwanted wrote:
>>>>
>>>> Yah there is more ot it, is there something specific you were looking 
>>>> for? Some javascript functions I have saved seperately like the one being 
>>>> called by the function in the controller 
>>>> *( _onclick="updatelivesearch(jQuery('#res%s').html())" % 
>>>> c.service_name )*
>>>> On Saturday, November 7, 2020 at 9:38:42 PM UTC+2 Jim S wrote:
>>>>
>>>>> There is more to it, right?  I see lots of javascript functions in 
>>>>> there with no definition.
>>>>>
>>>>> -Jim
>>>>>
>>>>>
>>>>> On Saturday, November 7, 2020 at 1:23:26 PM UTC-6, mostwanted wrote:
>>>>>>
>>>>>> 
>>>>>> 
>>>>>> SESOA™
>>>>>> Kgolagano Ya Kgwebo™
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> $(document).ready(function(){
>>>>>> $('a.service').on("click",function() {
>>>>>> const id = $(this).attr('id'); // Extract the data-id attribute of 
>>>>>> the link.
>>>>>>
>>>>>> $(data('id')==id).fadeIn(); // Select the contact with that id.
>>>>>> //e.preventDefault();
>>>>>>
>>>>>> });
>>>>>> });
>>>>>> 
>>>>>> >>>>> onkeyup="livesearch(this.value);" autofocus="" data-toggle="tooltip" 
>>>>>> data-placement="bottom" title="" data-original-title="Search by service 
>>>>>> or 
>>>>>> product">
>>>>>> loading ...>>>>> class="service" href="/init/default/companies/4" id="rescaww" 
>>>>>> onclick="updatesearch(jQuery('#rescaww').html())" style="font-weight: 
>>>>>> bold;">Carpentry and Wood Work>>>>> data-id="resCab">loading ...>>>>> href="/init/default/companies/20" 
>>>>>> id="rescab" onclick="updatesearch(jQuery('#rescab').html())" 
>>>>>> style="font-weight: bold;">Cab>>>>> data-id="resCar Electricity">loading ...>>>>> href="/init/default/companies/21" 
>>>>>> id="rescaeltcty" onclick="updatesearch(jQuery('#rescaeltcty').html())" 
>>>>>> style="font-weight: bold;">Car Electricity>>>>> class="link_loader" data-id="resPrivate Clinics  Health 
>>>>&

Re: [web2py] Re: Displaying content based on the id attribute

2020-11-07 Thread mostwanted
I dont think i wrote this  *$(data('id') == id)* properly but data('id') is 
supposed to return the data-id attribute of the hidden span i'm trying to 
show

On Saturday, November 7, 2020 at 10:32:53 PM UTC+2 Jim S wrote:

> I'm confused by this:
>
> $(data('id') == id).fadeIn(); // Select the contact with that id.
>
> What is data('id') supposed to return?
>
> Or is this some jquery thing I'm not aware of?
>
> -Jim
>
> On Saturday, November 7, 2020 at 1:57:01 PM UTC-6, mostwanted wrote:
>>
>> Yah there is more ot it, is there something specific you were looking 
>> for? Some javascript functions I have saved seperately like the one being 
>> called by the function in the controller 
>> *( _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name 
>> )*
>> On Saturday, November 7, 2020 at 9:38:42 PM UTC+2 Jim S wrote:
>>
>>> There is more to it, right?  I see lots of javascript functions in there 
>>> with no definition.
>>>
>>> -Jim
>>>
>>>
>>> On Saturday, November 7, 2020 at 1:23:26 PM UTC-6, mostwanted wrote:
>>>>
>>>> 
>>>> 
>>>> SESOA™
>>>> Kgolagano Ya Kgwebo™
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> $(document).ready(function(){
>>>> $('a.service').on("click",function() {
>>>> const id = $(this).attr('id'); // Extract the data-id attribute of the 
>>>> link.
>>>>
>>>> $(data('id')==id).fadeIn(); // Select the contact with that id.
>>>> //e.preventDefault();
>>>>
>>>> });
>>>> });
>>>> 
>>>> >>> onkeyup="livesearch(this.value);" autofocus="" data-toggle="tooltip" 
>>>> data-placement="bottom" title="" data-original-title="Search by service or 
>>>> product">
>>>> loading ...>>> class="service" href="/init/default/companies/4" id="rescaww" 
>>>> onclick="updatesearch(jQuery('#rescaww').html())" style="font-weight: 
>>>> bold;">Carpentry and Wood Work>>> data-id="resCab">loading ...>>> href="/init/default/companies/20" 
>>>> id="rescab" onclick="updatesearch(jQuery('#rescab').html())" 
>>>> style="font-weight: bold;">Cab>>> data-id="resCar Electricity">loading ...>>> href="/init/default/companies/21" 
>>>> id="rescaeltcty" onclick="updatesearch(jQuery('#rescaeltcty').html())" 
>>>> style="font-weight: bold;">Car Electricity>>> class="link_loader" data-id="resPrivate Clinics  Health Care">loading 
>>>> ...>>> href="/init/default/companies/29" id="resprvtclncs" 
>>>> onclick="updatesearch(jQuery('#resprvtclncs').html())" style="font-weight: 
>>>> bold;">Private Clinics  Health Care>>> class="link_loader" data-id="resFood Catering">loading ...>>> href="/init/default/companies/30" id="resfdctrng" 
>>>> onclick="updatesearch(jQuery('#resfdctrng').html())" style="font-weight: 
>>>> bold;">Food Catering>>> data-id="resElectrical Installation">loading ...>>> href="/init/default/companies/38" 
>>>> id="reselctrcn" onclick="updatesearch(jQuery('#reselctrcn').html())" 
>>>> style="font-weight: bold;">Electrical Installation>>> class="link_loader" data-id="resAcademic Tutoring">loading ...>>> class="fa fa-spinner fa-spin">>>> href="/init/default/companies/41" id="resadmcttrn" 
>>>> onclick="updatesearch(jQuery('#resadmcttrn').html())" style="font-weight: 
>>>> bold;">Academic Tutoring>>> data-id="resLandscaping and Gardening">loading ...>>> href="/init/default/companies/56" id="reslnscpngdng" 
>>>> onclick="updatesearch(jQuery('#reslnscpngdng').html())" 
>>>> style="font-weight: 
>>>> bold;">Landscaping and Gardening>>> data-id="resInternet Cafe">loading ...>>> href="/init/default/companies/73" 
>>>> id="resintcf" onclick="updatesearch(jQuery('#resintcf').html())" 
>&g

Re: [web2py] Re: Displaying content based on the id attribute

2020-11-07 Thread mostwanted
Yah there is more ot it, is there something specific you were looking for? 
Some javascript functions I have saved seperately like the one being called 
by the function in the controller 
*( _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name )*
On Saturday, November 7, 2020 at 9:38:42 PM UTC+2 Jim S wrote:

> There is more to it, right?  I see lots of javascript functions in there 
> with no definition.
>
> -Jim
>
>
> On Saturday, November 7, 2020 at 1:23:26 PM UTC-6, mostwanted wrote:
>>
>> 
>> 
>> SESOA™
>> Kgolagano Ya Kgwebo™
>> 
>> 
>> 
>> 
>> 
>> $(document).ready(function(){
>> $('a.service').on("click",function() {
>> const id = $(this).attr('id'); // Extract the data-id attribute of the 
>> link.
>>
>> $(data('id')==id).fadeIn(); // Select the contact with that id.
>> //e.preventDefault();
>>
>> });
>> });
>> 
>> > onkeyup="livesearch(this.value);" autofocus="" data-toggle="tooltip" 
>> data-placement="bottom" title="" data-original-title="Search by service or 
>> product">
>> > class="link_loader" data-id="resCarpentry and Wood Work">loading ...> class="fa fa-spinner fa-spin">> href="/init/default/companies/4" id="rescaww" 
>> onclick="updatesearch(jQuery('#rescaww').html())" style="font-weight: 
>> bold;">Carpentry and Wood Work> data-id="resCab">loading ...> id="rescab" onclick="updatesearch(jQuery('#rescab').html())" 
>> style="font-weight: bold;">Cab> data-id="resCar Electricity">loading ...> id="rescaeltcty" onclick="updatesearch(jQuery('#rescaeltcty').html())" 
>> style="font-weight: bold;">Car Electricity> class="link_loader" data-id="resPrivate Clinics  Health Care">loading 
>> ...> href="/init/default/companies/29" id="resprvtclncs" 
>> onclick="updatesearch(jQuery('#resprvtclncs').html())" style="font-weight: 
>> bold;">Private Clinics  Health Care> class="link_loader" data-id="resFood Catering">loading ...> href="/init/default/companies/30" id="resfdctrng" 
>> onclick="updatesearch(jQuery('#resfdctrng').html())" style="font-weight: 
>> bold;">Food Catering> data-id="resElectrical Installation">loading ...> id="reselctrcn" onclick="updatesearch(jQuery('#reselctrcn').html())" 
>> style="font-weight: bold;">Electrical Installation> class="link_loader" data-id="resAcademic Tutoring">loading ...> class="fa fa-spinner fa-spin">> href="/init/default/companies/41" id="resadmcttrn" 
>> onclick="updatesearch(jQuery('#resadmcttrn').html())" style="font-weight: 
>> bold;">Academic Tutoring> data-id="resLandscaping and Gardening">loading ...> href="/init/default/companies/56" id="reslnscpngdng" 
>> onclick="updatesearch(jQuery('#reslnscpngdng').html())" style="font-weight: 
>> bold;">Landscaping and Gardening> data-id="resInternet Cafe">loading ...> id="resintcf" onclick="updatesearch(jQuery('#resintcf').html())" 
>> style="font-weight: bold;">Internet Cafe> class="link_loader" data-id="resCalligrapher">loading ...> href="/init/default/companies/76" id="resclgrph" 
>> onclick="updatesearch(jQuery('#resclgrph').html())" style="font-weight: 
>> bold;">Calligrapher> data-id="resPre-school, Day Care Center, Creche">loading ...> href="/init/default/companies/79" id="rescreche" 
>> onclick="updatesearch(jQuery('#rescreche').html())" style="font-weight: 
>> bold;">Pre-school, Day Care Center, Creche> class="link_loader" data-id="resCar, Mats and Sofa Washes">loading ...> class="fa fa-spinner fa-spin">> href="/init/default/companies/80" id="rescmw" 
>> onclick="updatesearch(jQuery('#rescmw').html())" style="font-weight: 
>> bold;">Car, Mats and Sofa Washes> data-id="resCattle Breeding">loading ...> id="rescbrdn" onclick="updatesearch(jQuery('#rescbrdn').html())" 
>> style="font-weight: bold;">Cattle Breeding> class="link_loader" data-id=&qu

Re: [web2py] Re: Displaying content based on the id attribute

2020-11-07 Thread mostwanted


SESOA™
Kgolagano Ya Kgwebo™





$(document).ready(function(){
$('a.service').on("click",function() {
const id = $(this).attr('id'); // Extract the data-id attribute of the link.

$(data('id')==id).fadeIn(); // Select the contact with that id.
//e.preventDefault();

});
});


loading ...Carpentry and Wood Workloading ...Cabloading ...Car Electricityloading 
...Private Clinics  Health Careloading ...Food Cateringloading ...Electrical Installationloading ...Academic Tutoringloading ...Landscaping and Gardeningloading ...Internet Cafeloading ...Calligrapherloading ...Pre-school, Day Care Center, Crecheloading ...Car, Mats and Sofa Washesloading ...Cattle Breedingloading ...Cattle Trailer Hiringloading ...Scaffold Structure Hiringloading ...Car Parts  Componentsloading ...Electrical Parts  ComponentsCakes and Bakery ProductsBusiness Cards and FlyersBrahman CattleLab-Lab Cattle FeedNupia Grass Cattle FeedYellow Maize Cattle FeedNO 
RESULTS IN PRIVATE SELLERS!


I'm not sure if this is what you are looking for but that is what is 
generated for the above screenshot i sent earlier. 
Sorry i couldnt format the code in editor text, ever since the platform 
changed I never know how to format the code to look like the code with all 
the necessary color coding!
On Saturday, November 7, 2020 at 8:09:47 PM UTC+2 Jim S wrote:

> Sorry, I was looking for the actual html code that is generated.  
>
> -Jim
>
>
> On Saturday, November 7, 2020 at 12:06:32 PM UTC-6, mostwanted wrote:
>>
>> [image: Screenshot (38).png]
>> The links in the black box are the results generated when when a user 
>> searches for a service & those are the links that when clicked I need to 
>> display the hidden div next to them to show that the page is loading
>> On Saturday, November 7, 2020 at 7:49:47 PM UTC+2 Jim S wrote:
>>
>>> The page that was generated
>>>
>>> -Jim
>>>
>>> On Saturday, November 7, 2020 at 11:48:37 AM UTC-6, mostwanted wrote:
>>>>
>>>> What do you mean the final html Jim? Do you mean the actual code or the 
>>>> page generated?
>>>>
>>>> On Saturday, November 7, 2020 at 7:08:36 PM UTC+2 Jim S wrote:
>>>>
>>>>> Can you post the final html that is generated by web2py?
>>>>>
>>>>> -Jim
>>>>>
>>>>>
>>>>> On Saturday, November 7, 2020 at 10:52:29 AM UTC-6, mostwanted wrote:
>>>>>>
>>>>>> Hey Jim I did remove the _onclick function & tried to apply to the 
>>>>>> end of the listener as you've suggested but still nothing is happening, 
>>>>>> these links are not responsive & I dont know why!
>>>>>>
>>>>>> On Thursday, November 5, 2020 at 4:33:32 AM UTC+2 Jim S wrote:
>>>>>>
>>>>>>> Can you remove the _onclick from that element and add that function 
>>>>>>> call to the end of your listener defined in document ready?
>>>>>>>
>>>>>>> -Jim
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Nov 4, 2020 at 8:29 PM mostwanted  
>>>>>>> wrote:
>>>>>>>
>>>>>>>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.
>>>>>>>> service_name
>>>>>>>>
>>>>>>>> This is a function that displays suggested names through ajax 
>>>>>>>> auto-completion everytime a user types something on the 
>>>>>>>> search-textfield. 
>>>>>>>> When they type, a suggestion-div appears below the search-field with 
>>>>>>>> suggested names as links ofcourse and when the users identifies the 
>>>>>>>> name 
>>>>>>>> they were looking for & clicks on it this function populates the 
>>>>>>>> search-textfield with the clicked name & causes the suggestion-div 
>>>>>>>> with 
>>>>>>>> names to disappear.
>>>>>>>>
>>>>>>>> function updatelivesearch(value){
>>>>>>>> jQuery("#livesearch").val(value);
>>>>>>>> jQuery("#livesearchresults").hide();
>>>>>>>> }
>>>>>>>>
>>>>>>>> Thanks alot for your input Jim i'll keep working on it, one way or 
>>>>>>>> the other i'll figure it out.
>>>>>>>> Gratitude.
>>>>>>>>
>>>&

Re: [web2py] Re: Displaying content based on the id attribute

2020-11-07 Thread mostwanted
[image: Screenshot (38).png]
The links in the black box are the results generated when when a user 
searches for a service & those are the links that when clicked I need to 
display the hidden div next to them to show that the page is loading
On Saturday, November 7, 2020 at 7:49:47 PM UTC+2 Jim S wrote:

> The page that was generated
>
> -Jim
>
> On Saturday, November 7, 2020 at 11:48:37 AM UTC-6, mostwanted wrote:
>>
>> What do you mean the final html Jim? Do you mean the actual code or the 
>> page generated?
>>
>> On Saturday, November 7, 2020 at 7:08:36 PM UTC+2 Jim S wrote:
>>
>>> Can you post the final html that is generated by web2py?
>>>
>>> -Jim
>>>
>>>
>>> On Saturday, November 7, 2020 at 10:52:29 AM UTC-6, mostwanted wrote:
>>>>
>>>> Hey Jim I did remove the _onclick function & tried to apply to the end 
>>>> of the listener as you've suggested but still nothing is happening, these 
>>>> links are not responsive & I dont know why!
>>>>
>>>> On Thursday, November 5, 2020 at 4:33:32 AM UTC+2 Jim S wrote:
>>>>
>>>>> Can you remove the _onclick from that element and add that function 
>>>>> call to the end of your listener defined in document ready?
>>>>>
>>>>> -Jim
>>>>>
>>>>>
>>>>> On Wed, Nov 4, 2020 at 8:29 PM mostwanted  wrote:
>>>>>
>>>>>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name
>>>>>>
>>>>>> This is a function that displays suggested names through ajax 
>>>>>> auto-completion everytime a user types something on the 
>>>>>> search-textfield. 
>>>>>> When they type, a suggestion-div appears below the search-field with 
>>>>>> suggested names as links ofcourse and when the users identifies the name 
>>>>>> they were looking for & clicks on it this function populates the 
>>>>>> search-textfield with the clicked name & causes the suggestion-div with 
>>>>>> names to disappear.
>>>>>>
>>>>>> function updatelivesearch(value){
>>>>>> jQuery("#livesearch").val(value);
>>>>>> jQuery("#livesearchresults").hide();
>>>>>> }
>>>>>>
>>>>>> Thanks alot for your input Jim i'll keep working on it, one way or 
>>>>>> the other i'll figure it out.
>>>>>> Gratitude.
>>>>>>
>>>>>>
>>>>>> On Wednesday, November 4, 2020 at 7:34:44 PM UTC+2 Jim S wrote:
>>>>>>
>>>>>>> What is the 
>>>>>>>
>>>>>>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.
>>>>>>> service_name
>>>>>>>
>>>>>>> on your anchor tag inside your span?
>>>>>>>
>>>>>>> Can you try removing that?
>>>>>>>
>>>>>>> Since you have a listener for the click of that element already, I'm 
>>>>>>> not sure how it behaves if you have the onclick attribute set as well.  
>>>>>>> Maybe there are some stronger javascript people that can jump in.
>>>>>>>
>>>>>>> -Jim
>>>>>>>
>>>>>>>
>>>>>>> On Wednesday, November 4, 2020 at 11:23:45 AM UTC-6, mostwanted 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> *" Are you trying to show the span when the link is clicked 'while' 
>>>>>>>> the page is loaded?  ":  *Yes sir
>>>>>>>>
>>>>>>>> *" I'm guessing you are clicking the link after the page is loaded 
>>>>>>>> ": *Yes sir
>>>>>>>>
>>>>>>>> *"Also, where in your javascript did you add the console.log()?":  *I 
>>>>>>>> added it inside the click function just before initialization of the 
>>>>>>>> id 
>>>>>>>> variable
>>>>>>>>
>>>>>>>> **$(document).ready(function(){
>>>>>>>> $('.service').click(function(e) {
>>>>>>>> *console.log( "Hello world!" );*
>>>>>>

Re: [web2py] Re: Displaying content based on the id attribute

2020-11-07 Thread mostwanted
What do you mean the final html Jim? Do you mean the actual code or the 
page generated?

On Saturday, November 7, 2020 at 7:08:36 PM UTC+2 Jim S wrote:

> Can you post the final html that is generated by web2py?
>
> -Jim
>
>
> On Saturday, November 7, 2020 at 10:52:29 AM UTC-6, mostwanted wrote:
>>
>> Hey Jim I did remove the _onclick function & tried to apply to the end of 
>> the listener as you've suggested but still nothing is happening, these 
>> links are not responsive & I dont know why!
>>
>> On Thursday, November 5, 2020 at 4:33:32 AM UTC+2 Jim S wrote:
>>
>>> Can you remove the _onclick from that element and add that function call 
>>> to the end of your listener defined in document ready?
>>>
>>> -Jim
>>>
>>>
>>> On Wed, Nov 4, 2020 at 8:29 PM mostwanted  wrote:
>>>
>>>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name
>>>>
>>>> This is a function that displays suggested names through ajax 
>>>> auto-completion everytime a user types something on the search-textfield. 
>>>> When they type, a suggestion-div appears below the search-field with 
>>>> suggested names as links ofcourse and when the users identifies the name 
>>>> they were looking for & clicks on it this function populates the 
>>>> search-textfield with the clicked name & causes the suggestion-div with 
>>>> names to disappear.
>>>>
>>>> function updatelivesearch(value){
>>>> jQuery("#livesearch").val(value);
>>>> jQuery("#livesearchresults").hide();
>>>> }
>>>>
>>>> Thanks alot for your input Jim i'll keep working on it, one way or the 
>>>> other i'll figure it out.
>>>> Gratitude.
>>>>
>>>>
>>>> On Wednesday, November 4, 2020 at 7:34:44 PM UTC+2 Jim S wrote:
>>>>
>>>>> What is the 
>>>>>
>>>>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name
>>>>>
>>>>> on your anchor tag inside your span?
>>>>>
>>>>> Can you try removing that?
>>>>>
>>>>> Since you have a listener for the click of that element already, I'm 
>>>>> not sure how it behaves if you have the onclick attribute set as well.  
>>>>> Maybe there are some stronger javascript people that can jump in.
>>>>>
>>>>> -Jim
>>>>>
>>>>>
>>>>> On Wednesday, November 4, 2020 at 11:23:45 AM UTC-6, mostwanted wrote:
>>>>>>
>>>>>>
>>>>>> *" Are you trying to show the span when the link is clicked 'while' 
>>>>>> the page is loaded?  ":  *Yes sir
>>>>>>
>>>>>> *" I'm guessing you are clicking the link after the page is loaded ": 
>>>>>> *Yes sir
>>>>>>
>>>>>> *"Also, where in your javascript did you add the console.log()?":  *I 
>>>>>> added it inside the click function just before initialization of the id 
>>>>>> variable
>>>>>>
>>>>>> **$(document).ready(function(){
>>>>>> $('.service').click(function(e) {
>>>>>> *console.log( "Hello world!" );*
>>>>>> const id = $(this).data('id'); 
>>>>>> $('#' + id).fadeIn(); 
>>>>>> e.preventDefault();
>>>>>>
>>>>>> });
>>>>>> });
>>>>>> ** 
>>>>>> On Wednesday, November 4, 2020 at 4:09:12 PM UTC+2 Jim S wrote:
>>>>>>
>>>>>>> Ok, trying to better understand your intent.
>>>>>>>
>>>>>>> You said:
>>>>>>>
>>>>>>> I have a hidden span that i want displayed when a link is clisked 
>>>>>>> while waiting for the page to load but this is not working! I dont 
>>>>>>> know where I am going wrong but thought I had it right, please assist 
>>>>>>> me.
>>>>>>>
>>>>>>> Are you trying to show the span when the link is clicked 'while' the 
>>>>>>> page is loaded?  I'm guessing you are clicking the link after the page 
>>>>>>> is 
>>>>>>> loaded.  

Re: [web2py] Re: Displaying content based on the id attribute

2020-11-07 Thread mostwanted
Hey Jim I did remove the _onclick function & tried to apply to the end of 
the listener as you've suggested but still nothing is happening, these 
links are not responsive & I dont know why!

On Thursday, November 5, 2020 at 4:33:32 AM UTC+2 Jim S wrote:

> Can you remove the _onclick from that element and add that function call 
> to the end of your listener defined in document ready?
>
> -Jim
>
>
> On Wed, Nov 4, 2020 at 8:29 PM mostwanted  wrote:
>
>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name
>>
>> This is a function that displays suggested names through ajax 
>> auto-completion everytime a user types something on the search-textfield. 
>> When they type, a suggestion-div appears below the search-field with 
>> suggested names as links ofcourse and when the users identifies the name 
>> they were looking for & clicks on it this function populates the 
>> search-textfield with the clicked name & causes the suggestion-div with 
>> names to disappear.
>>
>> function updatelivesearch(value){
>> jQuery("#livesearch").val(value);
>> jQuery("#livesearchresults").hide();
>> }
>>
>> Thanks alot for your input Jim i'll keep working on it, one way or the 
>> other i'll figure it out.
>> Gratitude.
>>
>>
>> On Wednesday, November 4, 2020 at 7:34:44 PM UTC+2 Jim S wrote:
>>
>>> What is the 
>>>
>>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name
>>>
>>> on your anchor tag inside your span?
>>>
>>> Can you try removing that?
>>>
>>> Since you have a listener for the click of that element already, I'm not 
>>> sure how it behaves if you have the onclick attribute set as well.  Maybe 
>>> there are some stronger javascript people that can jump in.
>>>
>>> -Jim
>>>
>>>
>>> On Wednesday, November 4, 2020 at 11:23:45 AM UTC-6, mostwanted wrote:
>>>>
>>>>
>>>> *" Are you trying to show the span when the link is clicked 'while' the 
>>>> page is loaded?  ":  *Yes sir
>>>>
>>>> *" I'm guessing you are clicking the link after the page is loaded ": *Yes 
>>>> sir
>>>>
>>>> *"Also, where in your javascript did you add the console.log()?":  *I 
>>>> added it inside the click function just before initialization of the id 
>>>> variable
>>>>
>>>> **$(document).ready(function(){
>>>> $('.service').click(function(e) {
>>>> *console.log( "Hello world!" );*
>>>> const id = $(this).data('id'); 
>>>> $('#' + id).fadeIn(); 
>>>> e.preventDefault();
>>>>
>>>> });
>>>> });
>>>> ** 
>>>> On Wednesday, November 4, 2020 at 4:09:12 PM UTC+2 Jim S wrote:
>>>>
>>>>> Ok, trying to better understand your intent.
>>>>>
>>>>> You said:
>>>>>
>>>>> I have a hidden span that i want displayed when a link is clisked 
>>>>> while waiting for the page to load but this is not working! I dont 
>>>>> know where I am going wrong but thought I had it right, please assist me.
>>>>>
>>>>> Are you trying to show the span when the link is clicked 'while' the 
>>>>> page is loaded?  I'm guessing you are clicking the link after the page is 
>>>>> loaded.  Can you confirm?
>>>>>
>>>>> Also, where in your javascript did you add the console.log()?
>>>>>
>>>>> -Jim
>>>>>
>>>>>
>>>>> On Wednesday, November 4, 2020 at 12:34:02 AM UTC-6, mostwanted wrote:
>>>>>>
>>>>>> I threw in  console.log("Hello world!");  but its not printing 
>>>>>> anything on the console! The link events are not being handled!
>>>>>>
>>>>>>
>>>>>> On Tuesday, November 3, 2020 at 11:35:19 PM UTC+2 Jim S wrote:
>>>>>>
>>>>>>> Can you put some console.log() statements in your javascript inside 
>>>>>>> your function to see what is/isn't working?
>>>>>>>
>>>>>>> -Jim
>>>>>>>
>>>>>>>
>>>>>>> On Tuesday, November 3, 2020 at 12:10:06 PM UTC-6, mostwanted wrote:
>>>&g

[web2py] Re: Add to home screen

2020-11-07 Thread mostwanted
  Thanks alot, these links will come in handy
On Friday, November 6, 2020 at 12:56:47 AM UTC+2 snide...@gmail.com wrote:

>
>
> On Wednesday, May 27, 2020 at 3:08:15 AM UTC-7, mostwanted wrote:
>>
>> Whats the simplest way to get my web2py application to prompt users to 
>> add to screen? I have tried alot of things but none are working, there are 
>> no prompts happening! Some say its only achievable through a PWA design, i 
>> tried this 
>> https://groups.google.com/forum/#!searchin/web2py/pwa$20me%7Csort:date/web2py/rHBfs1zFG44/gKS6EOmlAgAJ
>>  
>>
>> nothing is working, if anyone has a way to achieve this with web2py i'd 
>> appreciate your assistance.
>>
>> Regards;
>>
>> Mostwanted
>>
>
>
> I found this reference, which helped me understand What The Heck you kids 
> were talking about.
>
> https://flaviocopes.com/progressive-web-apps/>
> https://flaviocopes.com/service-workers/>
>  
> Flavio is another Italian (in the northern lake district, I believe), but 
> his English is quite good.  He also has lots of tutorials about Vue, React, 
> javascript itself, CSS, and lots of stuff for the web-fingers.
>
> /dps
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/68aeffdb-1acf-4456-ad57-4e00eda4b820n%40googlegroups.com.


[web2py] Re: Displaying content based on the id attribute

2020-11-04 Thread mostwanted
 _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name

This is a function that displays suggested names through ajax 
auto-completion everytime a user types something on the search-textfield. 
When they type, a suggestion-div appears below the search-field with 
suggested names as links ofcourse and when the users identifies the name 
they were looking for & clicks on it this function populates the 
search-textfield with the clicked name & causes the suggestion-div with 
names to disappear.

function updatelivesearch(value){
jQuery("#livesearch").val(value);
jQuery("#livesearchresults").hide();
}

Thanks alot for your input Jim i'll keep working on it, one way or the 
other i'll figure it out.
Gratitude.


On Wednesday, November 4, 2020 at 7:34:44 PM UTC+2 Jim S wrote:

> What is the 
>
> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name
>
> on your anchor tag inside your span?
>
> Can you try removing that?
>
> Since you have a listener for the click of that element already, I'm not 
> sure how it behaves if you have the onclick attribute set as well.  Maybe 
> there are some stronger javascript people that can jump in.
>
> -Jim
>
>
> On Wednesday, November 4, 2020 at 11:23:45 AM UTC-6, mostwanted wrote:
>>
>>
>> *" Are you trying to show the span when the link is clicked 'while' the 
>> page is loaded?  ":  *Yes sir
>>
>> *" I'm guessing you are clicking the link after the page is loaded ": *Yes 
>> sir
>>
>> *"Also, where in your javascript did you add the console.log()?":  *I 
>> added it inside the click function just before initialization of the id 
>> variable
>>
>> **$(document).ready(function(){
>> $('.service').click(function(e) {
>> *console.log( "Hello world!" );*
>> const id = $(this).data('id'); 
>> $('#' + id).fadeIn(); 
>> e.preventDefault();
>>
>> });
>> });
>> ** 
>> On Wednesday, November 4, 2020 at 4:09:12 PM UTC+2 Jim S wrote:
>>
>>> Ok, trying to better understand your intent.
>>>
>>> You said:
>>>
>>> I have a hidden span that i want displayed when a link is clisked while 
>>> waiting for the page to load but this is not working! I dont know where 
>>> I am going wrong but thought I had it right, please assist me.
>>>
>>> Are you trying to show the span when the link is clicked 'while' the 
>>> page is loaded?  I'm guessing you are clicking the link after the page is 
>>> loaded.  Can you confirm?
>>>
>>> Also, where in your javascript did you add the console.log()?
>>>
>>> -Jim
>>>
>>>
>>> On Wednesday, November 4, 2020 at 12:34:02 AM UTC-6, mostwanted wrote:
>>>>
>>>> I threw in  console.log("Hello world!");  but its not printing anything 
>>>> on the console! The link events are not being handled!
>>>>
>>>>
>>>> On Tuesday, November 3, 2020 at 11:35:19 PM UTC+2 Jim S wrote:
>>>>
>>>>> Can you put some console.log() statements in your javascript inside 
>>>>> your function to see what is/isn't working?
>>>>>
>>>>> -Jim
>>>>>
>>>>>
>>>>> On Tuesday, November 3, 2020 at 12:10:06 PM UTC-6, mostwanted wrote:
>>>>>>
>>>>>> Hey Jim, I have but it shows no errors!
>>>>>>
>>>>>> On Tuesday, November 3, 2020 at 6:02:50 PM UTC+2 Jim S wrote:
>>>>>>
>>>>>>> Have you checked your browser console to see if you have any 
>>>>>>> javascript errors?
>>>>>>>
>>>>>>> -Jim
>>>>>>>
>>>>>>>
>>>>>>> On Tuesday, November 3, 2020 at 3:36:22 AM UTC-6, mostwanted wrote:
>>>>>>>>
>>>>>>>> I have a hidden span that i want displayed when a link is clisked 
>>>>>>>> while waiting for the page to load but this is not working! I dont 
>>>>>>>> know 
>>>>>>>> where I am going wrong but thought I had it right, please assist me.
>>>>>>>>
>>>>>>>> *CSS:*
>>>>>>>> .link_loader
>>>>>>>> {
>>>>>>>> display: none;
>>>>>>>> }
>>>>>>>>
>>>>>>>> *CONTROLL

[web2py] Re: Displaying content based on the id attribute

2020-11-04 Thread mostwanted
 _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name

this is a function that displays suggested names through ajax 
auto-completion evrytime the user types something on the textfield.
Thanks alot for your input Jim i'll keep working on it, one way or the 
other i'll figure it out.
Gratitude.

On Wednesday, November 4, 2020 at 7:34:44 PM UTC+2 Jim S wrote:

> What is the 
>
> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name
>
> on your anchor tag inside your span?
>
> Can you try removing that?
>
> Since you have a listener for the click of that element already, I'm not 
> sure how it behaves if you have the onclick attribute set as well.  Maybe 
> there are some stronger javascript people that can jump in.
>
> -Jim
>
>
> On Wednesday, November 4, 2020 at 11:23:45 AM UTC-6, mostwanted wrote:
>>
>>
>> *" Are you trying to show the span when the link is clicked 'while' the 
>> page is loaded?  ":  *Yes sir
>>
>> *" I'm guessing you are clicking the link after the page is loaded ": *Yes 
>> sir
>>
>> *"Also, where in your javascript did you add the console.log()?":  *I 
>> added it inside the click function just before initialization of the id 
>> variable
>>
>> **$(document).ready(function(){
>> $('.service').click(function(e) {
>> *console.log( "Hello world!" );*
>> const id = $(this).data('id'); 
>> $('#' + id).fadeIn(); 
>> e.preventDefault();
>>
>> });
>> });
>> ** 
>> On Wednesday, November 4, 2020 at 4:09:12 PM UTC+2 Jim S wrote:
>>
>>> Ok, trying to better understand your intent.
>>>
>>> You said:
>>>
>>> I have a hidden span that i want displayed when a link is clisked while 
>>> waiting for the page to load but this is not working! I dont know where 
>>> I am going wrong but thought I had it right, please assist me.
>>>
>>> Are you trying to show the span when the link is clicked 'while' the 
>>> page is loaded?  I'm guessing you are clicking the link after the page is 
>>> loaded.  Can you confirm?
>>>
>>> Also, where in your javascript did you add the console.log()?
>>>
>>> -Jim
>>>
>>>
>>> On Wednesday, November 4, 2020 at 12:34:02 AM UTC-6, mostwanted wrote:
>>>>
>>>> I threw in  console.log("Hello world!");  but its not printing anything 
>>>> on the console! The link events are not being handled!
>>>>
>>>>
>>>> On Tuesday, November 3, 2020 at 11:35:19 PM UTC+2 Jim S wrote:
>>>>
>>>>> Can you put some console.log() statements in your javascript inside 
>>>>> your function to see what is/isn't working?
>>>>>
>>>>> -Jim
>>>>>
>>>>>
>>>>> On Tuesday, November 3, 2020 at 12:10:06 PM UTC-6, mostwanted wrote:
>>>>>>
>>>>>> Hey Jim, I have but it shows no errors!
>>>>>>
>>>>>> On Tuesday, November 3, 2020 at 6:02:50 PM UTC+2 Jim S wrote:
>>>>>>
>>>>>>> Have you checked your browser console to see if you have any 
>>>>>>> javascript errors?
>>>>>>>
>>>>>>> -Jim
>>>>>>>
>>>>>>>
>>>>>>> On Tuesday, November 3, 2020 at 3:36:22 AM UTC-6, mostwanted wrote:
>>>>>>>>
>>>>>>>> I have a hidden span that i want displayed when a link is clisked 
>>>>>>>> while waiting for the page to load but this is not working! I dont 
>>>>>>>> know 
>>>>>>>> where I am going wrong but thought I had it right, please assist me.
>>>>>>>>
>>>>>>>> *CSS:*
>>>>>>>> .link_loader
>>>>>>>> {
>>>>>>>> display: none;
>>>>>>>> }
>>>>>>>>
>>>>>>>> *CONTROLLER*
>>>>>>>> *#The yellow line is the hidden span that has the loader I want to 
>>>>>>>> display*
>>>>>>>> def ajaxlivesearch():
>>>>>>>> keywords = request.vars.keywords
>>>>>>>> print "Keywords: " + str(keywords)
>>>>>>>>
>>>>>>>> if keywords:
>>&

[web2py] Re: Displaying content based on the id attribute

2020-11-04 Thread mostwanted

*" Are you trying to show the span when the link is clicked 'while' the 
page is loaded?  ":  *Yes sir

*" I'm guessing you are clicking the link after the page is loaded ": *Yes 
sir

*"Also, where in your javascript did you add the console.log()?":  *I added 
it inside the click function just before initialization of the id variable

**$(document).ready(function(){
$('.service').click(function(e) {
*console.log( "Hello world!" );*
const id = $(this).data('id'); 
$('#' + id).fadeIn(); 
e.preventDefault();

});
});
** 
On Wednesday, November 4, 2020 at 4:09:12 PM UTC+2 Jim S wrote:

> Ok, trying to better understand your intent.
>
> You said:
>
> I have a hidden span that i want displayed when a link is clisked while 
> waiting for the page to load but this is not working! I dont know where I 
> am going wrong but thought I had it right, please assist me.
>
> Are you trying to show the span when the link is clicked 'while' the page 
> is loaded?  I'm guessing you are clicking the link after the page is 
> loaded.  Can you confirm?
>
> Also, where in your javascript did you add the console.log()?
>
> -Jim
>
>
> On Wednesday, November 4, 2020 at 12:34:02 AM UTC-6, mostwanted wrote:
>>
>> I threw in  console.log("Hello world!");  but its not printing anything 
>> on the console! The link events are not being handled!
>>
>>
>> On Tuesday, November 3, 2020 at 11:35:19 PM UTC+2 Jim S wrote:
>>
>>> Can you put some console.log() statements in your javascript inside your 
>>> function to see what is/isn't working?
>>>
>>> -Jim
>>>
>>>
>>> On Tuesday, November 3, 2020 at 12:10:06 PM UTC-6, mostwanted wrote:
>>>>
>>>> Hey Jim, I have but it shows no errors!
>>>>
>>>> On Tuesday, November 3, 2020 at 6:02:50 PM UTC+2 Jim S wrote:
>>>>
>>>>> Have you checked your browser console to see if you have any 
>>>>> javascript errors?
>>>>>
>>>>> -Jim
>>>>>
>>>>>
>>>>> On Tuesday, November 3, 2020 at 3:36:22 AM UTC-6, mostwanted wrote:
>>>>>>
>>>>>> I have a hidden span that i want displayed when a link is clisked 
>>>>>> while waiting for the page to load but this is not working! I dont know 
>>>>>> where I am going wrong but thought I had it right, please assist me.
>>>>>>
>>>>>> *CSS:*
>>>>>> .link_loader
>>>>>> {
>>>>>> display: none;
>>>>>> }
>>>>>>
>>>>>> *CONTROLLER*
>>>>>> *#The yellow line is the hidden span that has the loader I want to 
>>>>>> display*
>>>>>> def ajaxlivesearch():
>>>>>> keywords = request.vars.keywords
>>>>>> print "Keywords: " + str(keywords)
>>>>>>
>>>>>> if keywords:
>>>>>> query = reduce(lambda 
>>>>>> a,b:a,[db.services.service_name.contains(k) for k in keywords.split()])
>>>>>> services = db(query).select()
>>>>>> items = []
>>>>>>
>>>>>> if services:
>>>>>>     for c in services: 
>>>>>> items.append(DIV*(SPAN("loading ...", SPAN(_class="fa 
>>>>>> fa-spinner fa-spin"), _class="link_loader", 
>>>>>> data={'id':"res%s"%c.service_name})*, A(c.service_name, 
>>>>>> _class="service", _style="font-weight: bold;", _href=URL('companies', 
>>>>>> args=
>>>>>> c.id), _id="res%s"%c.service_name, 
>>>>>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name)))
>>>>>>
>>>>>> *VIEW*
>>>>>> *#This jQuery script attempts to display the hidden span*
>>>>>>
>>>>>> **$(document).ready(function(){
>>>>>> $('.service').click(function(e) {
>>>>>> const id = $(this).data('id'); 
>>>>>> $('#' + id).fadeIn(); 
>>>>>> e.preventDefault();
>>>>>>
>>>>>> });
>>>>>> });
>>>>>>
>>>>>> **
>>>>>>
>>>>>> Regards;
>>>>>>
>>>>>> Mostwanted
>>>>>>
>>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5a8ef760-5106-4bdc-b1bc-c9feb44177f6n%40googlegroups.com.


[web2py] Re: Hosting my web2py application

2020-11-03 Thread mostwanted
I'm currently using pythonanywhere for some of my applications, I was just 
interested in hosting 1 or 2 of some.

On Wednesday, November 4, 2020 at 8:27:01 AM UTC+2 Rufus wrote:

> The technique we used with PHP was the php would call the python program 
> (or any other program callable from the linux shell) and take the output 
> from it or the files generated by it using PHP.
> This is not the same as generating web pages using python, or modifying 
> the HTML to include python code (like web2py, or, I imagine, django and 
> such)
> Have you looked at www.pythonanywhere.com?
>
>
> On Thursday, October 29, 2020 at 1:21:17 AM UTC-4 mostwanted wrote:
>
>> I've come across alot of information on setting up a domestic webserver I 
>> just wasnt sure if the same setup of hosting a PHP application would apply 
>> to hosting a Python application, I just thought it could be different but 
>> if its all the same thing I'll pick one & try it out.
>>
>> Regards
>>
>> On Tuesday, October 27, 2020 at 11:51:36 PM UTC+2 jonatha...@whatho.net 
>> wrote:
>>
>>> Do you want instructions on how to set up and run a server (Linux, 
>>> Windows?) on your home premises?
>>> Instructions on how to install web2py on such a server?
>>> Instructions on how to provide access to web browsers out on the 
>>> internet (e.g. setting up IP addresses on which the server can be 
>>> contacted?)
>>>
>>> These are big topics which (I would suggest) are outside the scope of 
>>> this group, and might require a fair bit of research. Also there are lots 
>>> of options depending on your requirements. None of it's specially difficult 
>>> but most of it is not specific to web2py.
>>>
>>>
>>> On Tuesday, 27 October 2020 at 15:44:30 UTC mostwanted wrote:
>>>
>>>> How do I setup a private home server to host my web2py application? 
>>>> What do i need & how do i put it together? If anyone has done it before 
>>>> please share the process or direct me to where I can find the information.
>>>>
>>>> Regards;
>>>>
>>>> Mostwanted
>>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6dac8e2a-e01a-4e23-9acd-cfbf12639b30n%40googlegroups.com.


[web2py] Re: Displaying content based on the id attribute

2020-11-03 Thread mostwanted
I threw in  console.log("Hello world!");  but its not printing anything on 
the console! The link events are not being handled!


On Tuesday, November 3, 2020 at 11:35:19 PM UTC+2 Jim S wrote:

> Can you put some console.log() statements in your javascript inside your 
> function to see what is/isn't working?
>
> -Jim
>
>
> On Tuesday, November 3, 2020 at 12:10:06 PM UTC-6, mostwanted wrote:
>>
>> Hey Jim, I have but it shows no errors!
>>
>> On Tuesday, November 3, 2020 at 6:02:50 PM UTC+2 Jim S wrote:
>>
>>> Have you checked your browser console to see if you have any javascript 
>>> errors?
>>>
>>> -Jim
>>>
>>>
>>> On Tuesday, November 3, 2020 at 3:36:22 AM UTC-6, mostwanted wrote:
>>>>
>>>> I have a hidden span that i want displayed when a link is clisked while 
>>>> waiting for the page to load but this is not working! I dont know where I 
>>>> am going wrong but thought I had it right, please assist me.
>>>>
>>>> *CSS:*
>>>> .link_loader
>>>> {
>>>> display: none;
>>>> }
>>>>
>>>> *CONTROLLER*
>>>> *#The yellow line is the hidden span that has the loader I want to 
>>>> display*
>>>> def ajaxlivesearch():
>>>> keywords = request.vars.keywords
>>>> print "Keywords: " + str(keywords)
>>>>
>>>> if keywords:
>>>> query = reduce(lambda 
>>>> a,b:a,[db.services.service_name.contains(k) for k in keywords.split()])
>>>> services = db(query).select()
>>>> items = []
>>>>
>>>> if services:
>>>> for c in services: 
>>>> items.append(DIV*(SPAN("loading ...", SPAN(_class="fa 
>>>> fa-spinner fa-spin"), _class="link_loader", 
>>>> data={'id':"res%s"%c.service_name})*, A(c.service_name, 
>>>> _class="service", _style="font-weight: bold;", _href=URL('companies', args=
>>>> c.id), _id="res%s"%c.service_name, 
>>>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name)))
>>>>
>>>> *VIEW*
>>>> *#This jQuery script attempts to display the hidden span*
>>>>
>>>> **$(document).ready(function(){
>>>> $('.service').click(function(e) {
>>>> const id = $(this).data('id'); 
>>>> $('#' + id).fadeIn(); 
>>>> e.preventDefault();
>>>>
>>>> });
>>>> });
>>>>
>>>> **
>>>>
>>>> Regards;
>>>>
>>>> Mostwanted
>>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/61e48a96-f5d5-46e2-9522-f5aeb92b9112n%40googlegroups.com.


[web2py] Re: Displaying content based on the id attribute

2020-11-03 Thread mostwanted
Hey Jim, I have but it shows no errors!

On Tuesday, November 3, 2020 at 6:02:50 PM UTC+2 Jim S wrote:

> Have you checked your browser console to see if you have any javascript 
> errors?
>
> -Jim
>
>
> On Tuesday, November 3, 2020 at 3:36:22 AM UTC-6, mostwanted wrote:
>>
>> I have a hidden span that i want displayed when a link is clisked while 
>> waiting for the page to load but this is not working! I dont know where I 
>> am going wrong but thought I had it right, please assist me.
>>
>> *CSS:*
>> .link_loader
>> {
>> display: none;
>> }
>>
>> *CONTROLLER*
>> *#The yellow line is the hidden span that has the loader I want to 
>> display*
>> def ajaxlivesearch():
>> keywords = request.vars.keywords
>> print "Keywords: " + str(keywords)
>>
>> if keywords:
>> query = reduce(lambda 
>> a,b:a,[db.services.service_name.contains(k) for k in keywords.split()])
>> services = db(query).select()
>> items = []
>>
>> if services:
>> for c in services: 
>> items.append(DIV*(SPAN("loading ...", SPAN(_class="fa 
>> fa-spinner fa-spin"), _class="link_loader", 
>> data={'id':"res%s"%c.service_name})*, A(c.service_name, 
>> _class="service", _style="font-weight: bold;", _href=URL('companies', args=
>> c.id), _id="res%s"%c.service_name, 
>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name)))
>>
>> *VIEW*
>> *#This jQuery script attempts to display the hidden span*
>>
>> **$(document).ready(function(){
>> $('.service').click(function(e) {
>> const id = $(this).data('id'); 
>> $('#' + id).fadeIn(); 
>> e.preventDefault();
>>
>> });
>> });
>>
>> **
>>
>> Regards;
>>
>> Mostwanted
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2d15fd90-4ee4-4ad9-a0e7-8c898a58bccan%40googlegroups.com.


[web2py] Displaying content based on the id attribute

2020-11-03 Thread mostwanted
I have a hidden span that i want displayed when a link is clisked while 
waiting for the page to load but this is not working! I dont know where I 
am going wrong but thought I had it right, please assist me.

*CSS:*
.link_loader
{
display: none;
}

*CONTROLLER*
*#The yellow line is the hidden span that has the loader I want to display*
def ajaxlivesearch():
keywords = request.vars.keywords
print "Keywords: " + str(keywords)

if keywords:
query = reduce(lambda a,b:a,[db.services.service_name.contains(k) 
for k in keywords.split()])
services = db(query).select()
items = []

if services:
for c in services: 
items.append(DIV*(SPAN("loading ...", SPAN(_class="fa 
fa-spinner fa-spin"), _class="link_loader", 
data={'id':"res%s"%c.service_name})*, A(c.service_name, _class="service", 
_style="font-weight: bold;", _href=URL('companies', args=c.id), 
_id="res%s"%c.service_name, 
_onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name)))

*VIEW*
*#This jQuery script attempts to display the hidden span*

**$(document).ready(function(){
$('.service').click(function(e) {
const id = $(this).data('id'); 
$('#' + id).fadeIn(); 
e.preventDefault();

});
});

**

Regards;

Mostwanted

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3b8a175c-ecdc-47e5-a157-45e7fe260f9fn%40googlegroups.com.


[web2py] Re: Hosting my web2py application

2020-10-28 Thread mostwanted
I've come across alot of information on setting up a domestic webserver I 
just wasnt sure if the same setup of hosting a PHP application would apply 
to hosting a Python application, I just thought it could be different but 
if its all the same thing I'll pick one & try it out.

Regards

On Tuesday, October 27, 2020 at 11:51:36 PM UTC+2 jonatha...@whatho.net 
wrote:

> Do you want instructions on how to set up and run a server (Linux, 
> Windows?) on your home premises?
> Instructions on how to install web2py on such a server?
> Instructions on how to provide access to web browsers out on the internet 
> (e.g. setting up IP addresses on which the server can be contacted?)
>
> These are big topics which (I would suggest) are outside the scope of this 
> group, and might require a fair bit of research. Also there are lots of 
> options depending on your requirements. None of it's specially difficult 
> but most of it is not specific to web2py.
>
>
> On Tuesday, 27 October 2020 at 15:44:30 UTC mostwanted wrote:
>
>> How do I setup a private home server to host my web2py application? What 
>> do i need & how do i put it together? If anyone has done it before please 
>> share the process or direct me to where I can find the information.
>>
>> Regards;
>>
>> Mostwanted
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bda36beb-a932-487e-ba15-d018283371d9n%40googlegroups.com.


[web2py] Re: Add to home screen

2020-10-28 Thread mostwanted
I was finally able to get my app to prompt add to screen. My app is hosted 
on pythonanywhere.com & its all thanks to Giles Thomas overthere at 
Pythonanywhere.com for assisting me with what I could do. 

What I did was that I set up a static file mapping on my "Web" tab page. 
I set  "URL"  to "/sw.js" and "Directory"  to 
"/home/myusername/web2py/applications/init/static/js/sw.js" In my 
pythonanywhere.com dashboard. 

>From there I changed the navigator.serviceWorker.register('/sw-location') 
arguments of the /main.js script to point to my /sw.js script served now 
from my root directory & no longer from sub-directories in my app as set up 
above:

*Main.js Script*
window.onload = () =>
{
  'use strict';

  if ('serviceWorker' in navigator)
{
   * navigator.serviceWorker.register('https://www.my-app.com/sw.js');*
  }
} 

Regards;

Mostwanted
On Wednesday, October 28, 2020 at 8:19:20 AM UTC+2 mostwanted wrote:

> Hey guys, I'm still here, struggling with the add to home PWA 
> fucntionality. Has anyone found a solution? Please share or assist.
>
> Regards
>
> On Monday, August 24, 2020 at 10:42:57 AM UTC+2 mostwanted wrote:
>
>> Hey guys i'm still struggling with the *add to home screen* prompt, 
>> please look at my code above & suggest something. Help me to get this to 
>> work. I really need this functionality, please help me.
>>
>> Regards;
>>
>> Mostwanted
>> On Friday, May 29, 2020 at 12:46:38 AM UTC+2 mostwanted wrote:
>>
>>> Ok! So far I have been able to get some aspects of my PWA project 
>>> working, The issue is that I have to install the app manually from the 
>>> browser's menu but it installs with its icon & it can be launched from the 
>>> icon with a splash screen, that's a minor success, it also opens fully like 
>>> a standalone app, another achievement, it shows its respecting the manifest 
>>> file rules,  Now the major problems are that offline functionality & a 
>>> prompt by the browser to install the app on home screen are not working and 
>>> apparently this is caused by a service worker that can not be detected! The 
>>> error says:
>>>
>>> *"No matching service worker detected. You may need to reload page or 
>>> check that the scope of the service worker for the current page encloses 
>>> the scope of the start URL from the manifest."*
>>>
>>> I do not understand this message at all, I went through the internet 
>>> looking for possible answers but none of them are clear! Some are saying 
>>> the solution is to place the service worker in the root directory! But guys 
>>> please forgive my ignorance but where is the web2py root directory?! If 
>>> anyone has been able to overcome this issue or understands the solution to 
>>> it i'd greatly appreciate your assistance, my site is being hosted by 
>>> pythonanywhere I dont know if this matters (Root Directories & all)!
>>> This is my code below:
>>>
>>> *LAYOUT CODE:*
>>>
>>> 
>>>
>>>   
>>>   >> href="/init/static/images/icon_152x152.png">
>>>   
>>>   
>>>   
>>>   
>>>   
>>>   
>>>   >> content="/init/static/images/icon_144x144.png">
>>>   
>>>
>>>
>>>   
>>>
>>>
>>> *MAIN.JS*
>>> window.onload = () =>
>>> {
>>>   'use strict';
>>>
>>>   if ('serviceWorker' in navigator) {
>>> navigator.serviceWorker.register('/init/static/js/sw.js');
>>>   }
>>> }
>>>
>>>
>>> *SW.JS*
>>> var cacheName = 'hello-pwa';
>>> var filesToCache = [
>>>   '/',
>>>   '/init/',
>>> ];
>>>
>>> /* Start the service worker and cache all of the app's content */
>>> self.addEventListener('install', function(e) {
>>>   e.waitUntil(
>>> caches.open(cacheName).then(function(cache) {
>>>   return cache.addAll(filesToCache);
>>> })
>>>   );
>>> });
>>>
>>> /* Serve cached content when offline */
>>> self.addEventListener('fetch', function(e) {
>>>   e.respondWith(
>>> caches.match(e.request).then(function(response) {
>>>   return response || fetch(e.request);
>>> })
>>>   );
>>> });
>>>
>>>
>>> *MANIFEST.JSON*
>>> {
>>>   "name": "Hello World",
>>>   "short_name&qu

[web2py] Re: Add to home screen

2020-10-28 Thread mostwanted
Hey guys, I'm still here, struggling with the add to home PWA 
fucntionality. Has anyone found a solution? Please share or assist.

Regards

On Monday, August 24, 2020 at 10:42:57 AM UTC+2 mostwanted wrote:

> Hey guys i'm still struggling with the *add to home screen* prompt, 
> please look at my code above & suggest something. Help me to get this to 
> work. I really need this functionality, please help me.
>
> Regards;
>
> Mostwanted
> On Friday, May 29, 2020 at 12:46:38 AM UTC+2 mostwanted wrote:
>
>> Ok! So far I have been able to get some aspects of my PWA project 
>> working, The issue is that I have to install the app manually from the 
>> browser's menu but it installs with its icon & it can be launched from the 
>> icon with a splash screen, that's a minor success, it also opens fully like 
>> a standalone app, another achievement, it shows its respecting the manifest 
>> file rules,  Now the major problems are that offline functionality & a 
>> prompt by the browser to install the app on home screen are not working and 
>> apparently this is caused by a service worker that can not be detected! The 
>> error says:
>>
>> *"No matching service worker detected. You may need to reload page or 
>> check that the scope of the service worker for the current page encloses 
>> the scope of the start URL from the manifest."*
>>
>> I do not understand this message at all, I went through the internet 
>> looking for possible answers but none of them are clear! Some are saying 
>> the solution is to place the service worker in the root directory! But guys 
>> please forgive my ignorance but where is the web2py root directory?! If 
>> anyone has been able to overcome this issue or understands the solution to 
>> it i'd greatly appreciate your assistance, my site is being hosted by 
>> pythonanywhere I dont know if this matters (Root Directories & all)!
>> This is my code below:
>>
>> *LAYOUT CODE:*
>>
>> 
>>
>>   
>>   > href="/init/static/images/icon_152x152.png">
>>   
>>   
>>   
>>   
>>   
>>   
>>   > content="/init/static/images/icon_144x144.png">
>>   
>>
>>
>>   
>>
>>
>> *MAIN.JS*
>> window.onload = () =>
>> {
>>   'use strict';
>>
>>   if ('serviceWorker' in navigator) {
>> navigator.serviceWorker.register('/init/static/js/sw.js');
>>   }
>> }
>>
>>
>> *SW.JS*
>> var cacheName = 'hello-pwa';
>> var filesToCache = [
>>   '/',
>>   '/init/',
>> ];
>>
>> /* Start the service worker and cache all of the app's content */
>> self.addEventListener('install', function(e) {
>>   e.waitUntil(
>> caches.open(cacheName).then(function(cache) {
>>   return cache.addAll(filesToCache);
>> })
>>   );
>> });
>>
>> /* Serve cached content when offline */
>> self.addEventListener('fetch', function(e) {
>>   e.respondWith(
>> caches.match(e.request).then(function(response) {
>>   return response || fetch(e.request);
>> })
>>   );
>> });
>>
>>
>> *MANIFEST.JSON*
>> {
>>   "name": "Hello World",
>>   "short_name": "Hello",
>>   "lang": "en-US",
>>   "background_color": "#DE3C4B",
>>   "theme_color": "#DE3C4B",
>>   "icons": [
>> {
>>   "src": "/init/static/images/icon_72x72.png",
>>   "sizes": "72x72",
>>   "type": "image/png"
>> },
>> {
>>   "src": "/init/static/images/icon_96x96.png",
>>   "sizes": "96x96",
>>   "type": "image/png"
>> },
>> {
>>   "src": "/init/static/images/icon_128x128.png",
>>   "sizes": "128x128",
>>   "type": "image/png"
>> },
>> {
>>   "src": "/init/static/images/icon_144x144.png",
>>   "sizes": "144x144",
>>   "type": "image/png"
>> },
>> {
>>   "src": "/init/static/images/icon_152x152.png",
>>   "sizes": "152x152",
>>   "type": "image/png"
>> },
>> {
>>   "src": "/init/static/im

[web2py] Hosting my web2py application

2020-10-27 Thread mostwanted
How do I setup a private home server to host my web2py application? What do 
i need & how do i put it together? If anyone has done it before please 
share the process or direct me to where I can find the information.

Regards;

Mostwanted

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6d1e2e29-a423-43d2-b9fe-1e6cae251f26n%40googlegroups.com.


[web2py] Limiting database entries

2020-10-13 Thread mostwanted
Is there a way to limit the number of entries to a database?
Like limiting the number of entries to only 100 and nothing more.

Regards;

Mostwanted 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/23c3a45f-bc13-4374-8c00-3c3689422f1dn%40googlegroups.com.


[web2py] Re: uploadfolder=request.folder not working as it expected

2020-10-08 Thread mostwanted
This worked, thanks Villas

On Tuesday, October 6, 2020 at 1:43:37 PM UTC+2 villas wrote:

> Maybe you are not using a separator (eg '/').  Try something like this:
>
> uploadfolder = os.path.join(request.folder, 'static/docs') 
>
> On Monday, 5 October 2020 at 17:21:43 UTC+1 mostwanted wrote:
>
>> *uploadfolder=request.folder+'static/docs'  *suddenly aint working as it 
>> should, initially is worked. What should happen is that when i save a PDF 
>> file it should be save in a static folder called *docs  *& in a database 
>> table but the *docs *folder in static doesnt get created now I am 
>> getting the *404 NOT FOUND *when i try to view or open the PDF. I dont 
>> know why this is suddenly happening when it used to work, do i need import 
>> some python library or change my code somwhere?
>>
>> *CODE:*
>> *model:*
>>
>>
>>
>>
>> *db.define_table('pdfs',Field('Form_Name', 
>> label=SPAN('Document Title', _style="font-weight: bold;"), widget=lambda 
>> field, value:SQLFORM.widgets.string.widget(field, value, 
>> _placeholder="Invoice/PO/Quotation Name")),Field('status', 
>> 'boolean', label=SPAN('Status (For Invoices Only)', _style="font-weight: 
>> bold;")),Field('status_condition', 
>> requires=IS_IN_SET(['Quotation', 'Paid', 'Unpaid', 'Cancelled', 'Paid With 
>> Balance'], zero=None), label=SPAN('Status Condition', _style="font-weight: 
>> bold;")),
>> Field('fileS','upload',uploadfolder=request.folder+'static/docs', 
>> label=SPAN('Upload Files', _style="font-weight: bold;")))*
>>
>> *CONTROLLER:*
>>
>>
>>
>>
>> *def saveDocument():form=SQLFORM(db.pdfs)if 
>> form.process().accepted:response.flash=T('Form Saved')return 
>> locals()*
>>
>>
>>
>> *def viewer():row = db(db.pdfs.id 
>> <http://db.pdfs.id>==request.args(0)).select(db.pdfs.fileS).first()    
>> redirect(URL('static','docs',args=row.fileS))*
>>
>>
>> *VIEW FOR SAVED DOCUMENT VIEWING*
>>
>> *{{extend 'layout.html'}}*
>>
>>
>>
>> *{{for details in details2: }}{{=A(details.Form_Name, 
>> _target="_blank", _href=URL('viewer', args=details.id 
>> <http://details.id>))}} {{pass}}*
>>
>> Regards;
>>
>> Mostwanted
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/30edba5a-f0de-49ae-a295-5c80319d5081n%40googlegroups.com.


[web2py] uploadfolder=request.folder not working as it expected

2020-10-05 Thread mostwanted
*uploadfolder=request.folder+'static/docs'  *suddenly aint working as it 
should, initially is worked. What should happen is that when i save a PDF 
file it should be save in a static folder called *docs  *& in a database 
table but the *docs *folder in static doesnt get created now I am getting 
the *404 NOT FOUND *when i try to view or open the PDF. I dont know why 
this is suddenly happening when it used to work, do i need import some 
python library or change my code somwhere?

*CODE:*
*model:*




*db.define_table('pdfs',Field('Form_Name', 
label=SPAN('Document Title', _style="font-weight: bold;"), widget=lambda 
field, value:SQLFORM.widgets.string.widget(field, value, 
_placeholder="Invoice/PO/Quotation Name")),Field('status', 
'boolean', label=SPAN('Status (For Invoices Only)', _style="font-weight: 
bold;")),Field('status_condition', 
requires=IS_IN_SET(['Quotation', 'Paid', 'Unpaid', 'Cancelled', 'Paid With 
Balance'], zero=None), label=SPAN('Status Condition', _style="font-weight: 
bold;")),
Field('fileS','upload',uploadfolder=request.folder+'static/docs', 
label=SPAN('Upload Files', _style="font-weight: bold;")))*

*CONTROLLER:*




*def saveDocument():form=SQLFORM(db.pdfs)if 
form.process().accepted:response.flash=T('Form Saved')return 
locals()*



*def viewer():row = 
db(db.pdfs.id==request.args(0)).select(db.pdfs.fileS).first()
redirect(URL('static','docs',args=row.fileS))*


*VIEW FOR SAVED DOCUMENT VIEWING*

*{{extend 'layout.html'}}*



*{{for details in details2: }}{{=A(details.Form_Name, 
_target="_blank", _href=URL('viewer', args=details.id))}} {{pass}}*

Regards;

Mostwanted

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0e934eae-fd5b-48b1-a744-42c8d89702fen%40googlegroups.com.


  1   2   3   4   5   >