[web2py] message in register form

2021-10-11 Thread lucas
hello one and all,

how can i add a simple message to the /user/register form?  just plain text 
with a link in there also.

thank you in advance, lucas

-- 
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/a8767ae3-76e1-4e34-8e3f-5f2e99742154n%40googlegroups.com.


[web2py] Re: belongs DAL syntax to search word contains in list:reference type Field

2021-10-11 Thread 黄祥
nested_select = db(db.address.address.contains('boulevard') ).*_select*
(db.address.id)
*result in browser *
SELECT "address"."id" FROM "address" WHERE (LOWER("address"."address") LIKE 
'%boulevard%' ESCAPE '\');

rows = db(db.customer.address.belongs(nested_select) ).select()
*result in browser*
nothing (no error occured but the resuls is not expected)

select = db(db.address.address.contains('boulevard') ).*select*
(db.address.id)
*result in browser (only this work as expected)*
return db.address.id

any idea ?

thanks

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


[web2py] Re: sqlhtml changes for sqlform.factory, not nice, 2.15.4 versus 2.18.5

2021-10-11 Thread 'Awe' via web2py-users
Hello Massimo,
thanks for replying.
Maybe I didn't quite understand.
I assumed that when using the Sqlform.factory no "record" is transmitted. This 
means that the "create" branch is always used in 2.21, 2.18, 2.15.4, 
independent 
of "create" or "edit" forms. In my point of view, for sqlform.factory, 
there is no difference between create / edit. For my purposes, the "old" 
code
fields = [f.name for f in table if  (ignore_rw or f.writable or 
f.readable) 
and (readonly or not f.compute)]
was correct, cause I want to show a readable Field in an edit form, even 
when its value is "" 
but changing to "f.readable and f.default", when f.default = "", will 
result in a no show.
Am I wrong?

code, 2.21, 2.18,
if fields is None:
  if not readonly:
if not record:
# create form should only show writable fields
fields = [f.name for f in table if (ignore_rw or 
f.writable or (f.readable and f.default)) and not f.compute]
else:
   # update form should also show readable fields and 
computed fields (but in reaodnly mode)
   fields = [f.name for f in table if (ignore_rw or 
f.writable or f.readable)]
else:
   # read only form should show all readable fields
   fields = [f.name for f in table if (ignore_rw or f.readable)]
Massimo Di Pierro schrieb am Sonntag, 10. Oktober 2021 um 06:27:42 UTC+2:

> Looking at latest version 2.21. The change you mention is only for create 
> forms, not edit forms. It basically say if a field is readable and not 
> writable and has not value, it should not be displayed. It seems the 
> correct behavior to me. Maybe in 1.18 the same logic was incorrectly 
> applied to edit fors as well? Do not remember. Please try the latest.
>
>
>
> On Saturday, 9 October 2021 at 14:14:17 UTC-7 Awe wrote:
>
>> Thanks for the answer 
>> I haven't tried the latest version and I hope this behavior doesn't 
>> change from version to version..
>> but. I thought / hoped a web2py developer could explain why this 
>> important/central feature was changed and how to deal with it best.
>> Jim S schrieb am Samstag, 2. Oktober 2021 um 16:26:42 UTC+2:
>>
>>> Have you tried with the latest web2py?
>>>
>>> I'm assuming the behavior is the same as with 2.18.5. 
>>>
>>> Have you been able to pinpoint a commit that would have changed this 
>>> behavior?
>>>
>>> -Jim
>>>
>>> On Thursday, September 30, 2021 at 4:04:28 AM UTC-5 Awe wrote:
>>>
 Is anybody out there facing the same problem, wondering about getting 
 no answers...

 Awe schrieb am Mittwoch, 4. August 2021 um 18:16:40 UTC+2:

> we are using sqlform.factory a lot, but the way fields are 
> shown/behave was changed from
> 2.15.4
> fields = [f.name for f in table if  (ignore_rw or f.writable or 
> f.readable) 
> and (readonly or not f.compute)]
> to
> 2.18.5
> fields = [f.name for f in table if (ignore_rw or f.writable or 
> (f.readable and f.default)) and not f.compute]
>
> so in 2.15.4 it was no problem to have an edit form with fields like
> readable=True, writable=False, default=""
> this field having an empty string was shown disabled, great as 
> expected.
>
> in 2.18.5
> this field will not be shown anymore, we need to set default=" " like 
> this, which is
> not very useful.
>
> Is this a bug or feature, or is there a NEW common way to have empty 
> readonly fields in an
> edit form
>
> Many thanks for any help!
>


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6bd50f48-d1a5-4140-9946-08a9579ce41an%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.