[web2py] Re: Need help with student attendance app

2017-05-06 Thread pbreit
I think you're on the right track. It's a personal thing but I like 
defining my tables in the singular (ie, class, student, attendence).

As Donald indicated, your current model is best suited for each student 
only being in one class (which is fine for elementary school). It would 
work for students taking multiple classes but each student would be 
represented multiple times in DB.

I don't think "default=db.classes.id" is going to work.

You could have some controllers like:

def class_list():
  classes = db(db.classes.id>0).select()
  return dict(classes=classes)

def class():
  class = db.classes(request.args(0, cast=int)) or 
redirect(URL('class_list'))
  students = db(db.students.class_id==class.id).select()
  return dict(class=class, students=students)

def attendance():
  db.attendance.update(class_id=request.vars.class_id, 
student_id=request.vars.student_id, Attend=attendance)
  response.flash = 'Attendance recorded'
  redirect URL('class_list', args=[class_id])

Once you get this working, you could investigate an Ajax approach.
  

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


[web2py] Re: https://observatory.mozilla.org

2017-05-06 Thread Anthony
Looks like the low score is largely due to the lack of HTTPS support, as 
well as a few security related HTTP headers we are not setting.

Anthony

On Friday, May 5, 2017 at 8:43:56 PM UTC-4, Alex Glaros wrote:
>
> is https://observatory.mozilla.org providing bogus results?
>
> thanks, 
>
> Alex Glaros
>
>
> Host: web2py.com
> Scan ID #: 3686681
> Test Time: May 5, 2017 5:36 PM
> Test Duration: 3 seconds
>
> Score: 0/100
> Tests Passed: 5/11
>
>
>
>

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


[web2py] Re: convert virtual field in grid to another language

2017-05-06 Thread Anthony
On Saturday, May 6, 2017 at 4:50:47 AM UTC-4, Andrea Fae' wrote:
>
> Solution:
> db.evento.giorno_inizio.represent = lambda giorno_inizio, row: 
> T(giorno_inizio)
>
> But I don't know whhy I have to specify "row" in tha lambda function...
>

The "represent" function must have a particular form, as the framework will 
call it by passing two arguments -- the first argument is the value of the 
field itself, and the second argument is the entire row object. In any 
given case, you may not need one or the other of those arguments, but they 
are both provided for maximum flexibility regarding how you want to 
represent the field (in many cases, you need values of other fields in the 
same record).

Anthony

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


[web2py] Re: Turning a web2py App in to an installable stand alone desktop App

2017-05-06 Thread Anthony
There's this option for Windows and Mac: 
http://web2py.com/books/default/chapter/29/14/other-recipes#How-to-distribute-your-applications-as-binaries

Anthony

On Saturday, May 6, 2017 at 6:28:23 AM UTC-4, mostwanted wrote:
>
>
>  Hi guys, how can I make a web2py App into an installable desktop stand 
> alone App?
>

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


Re: [web2py] why cant I submit a customized form with this button

2017-05-06 Thread Maurice Waka
Second option is perfect. Thanks for the information.

On May 5, 2017 18:25, "Jim S"  wrote:

Can you try the following:

1.  

or

2.  {{=form.custom.submit}} and then control your text and classes
through your controller.

-Jim


On Friday, May 5, 2017 at 10:17:06 AM UTC-5, Maurice Waka wrote:

> Without js, form still only submitted by hitting enter. I'll check this
> other link. Regards
>
> On May 5, 2017 18:07, "Jim S"  wrote:
>
>> Can you strip out all of your javascript and confirm that the standard
>> form submission is working with Kiran's solution?
>>
>> Then, put your javascript back in and watch the javascript console during
>> execution to see where you're getting hung up?
>>
>> Then for your second issue, have you looked at javascript/jquery
>> solutions?  Such as http://stackoverflow.com/qu
>> estions/895171/prevent-users-from-submitting-a-form-by-hitting-enter
>>
>> -Jim
>>
>> On Friday, May 5, 2017 at 9:56:28 AM UTC-5, Maurice Waka wrote:
>>>
>>> Still no change. How about the preventing page refreshing
>>>
>>> On May 5, 2017 10:06, "Kiran Subbaraman"  wrote:
>>>
 The `{{=form.custom.end}}` has to be after the submit button.
 http://web2py.com/books/default/chapter/29/07/forms-and-
 validators#Custom-forms

 
 Kiran Subbaramanhttp://subbaraman.wordpress.com/about/

 On Fri, 05-05-2017 11:15 AM, Maurice Waka wrote:

 I have a web2py app, with two problems:

 1. I can submit the customized form with pressing 'Enter' but when
 clicking the button, I get an error.

 2. when pressing 'Enter', the form is submitted but the page is
 refreshed immediately. How can i stop that?

 Here is the code; This does not work

 
 {{=form.custom.begin}}
 
 {{=form.custom.end}}>>> class="send_message">Send

 This does not work either:

 
 {{=form.custom.begin}}
 
 {{=form.custom.end}}
 Send 
 

 This is the js code:

 (function () {
 var Message;Message = function (arg) {
 this.text = arg.text, this.message_side = arg.message_side;
 this.draw = function (_this) {
 return function () {
 var $message;
 $message = $($('.message_template').clone().html());
 
 $message.addClass(_this.message_side).find('.text').html(_this.text);
 $('.messages').append($message);
 return setTimeout(function () {
 return $message.addClass('appeared');
 }, 0);
 };
 }(this);
 return this;};
 $(function () {
 var getMessageText, message_side, sendMessage;
 message_side = 'right';
 getMessageText = function () {
 var $message_input;
 $message_input = $('.message_input');
 return $message_input.val();
 };
 sendMessage = function (text) {
 var $messages, message;
 if (text.trim() === '') {
 return;
 }
 $('.message_input').val('');
 $messages = $('.messages');
 message_side = message_side === 'left' ? 'right' : 'left';
 message = new Message({
 text: text,
 message_side: message_side
 });
 message.draw();
 return $messages.animate({ scrollTop: 
 $messages.prop('scrollHeight') }, 300);
 };
 $('.send_message').click(function (e) {
 return sendMessage(getMessageText());
 });
 $('.message_input').keyup(function (e) {
 if (e.which === 13) {
 return sendMessage(getMessageText());
 }
 });



 --
 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.
 For more options, visit https://groups.google.com/d/optout.


 --
 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/to
 pic/web2py/oEjq7ACIqwI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+un...@googlegroups.com.
 For more op

[web2py] Turning a web2py App in to an installable stand alone desktop App

2017-05-06 Thread mostwanted

 Hi guys, how can I make a web2py App into an installable desktop stand 
alone App?

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


[web2py] Re: convert virtual field in grid to another language

2017-05-06 Thread Andrea Fae'
Solution:
db.evento.giorno_inizio.represent = lambda giorno_inizio, row: 
T(giorno_inizio)

But I don't know whhy I have to specify "row" in tha lambda function...

Il giorno venerdì 5 maggio 2017 22:44:10 UTC+2, Dave S ha scritto:
>
>
>
> On Friday, May 5, 2017 at 12:09:38 PM UTC-7, Andrea Fae' wrote:
>>
>> I have this table
>>
>> db.define_table('evento',
>> Field('titolo', requires=[IS_NOT_EMPTY()]),
>> Field('inizio', type='datetime'),
>> Field('fine', type='datetime'),
>> Field.Virtual('giorno_inizio', lambda 
>> row:calendar.day_name[row.evento.inizio.weekday()]),
>> Field('risorsa', 'reference risorsa'),
>> Field('docente', 'reference auth_user'),
>> Field('materia', 'reference materia'),
>> Field('studenti', 'list:reference auth_user'),
>> Field('colore', default = '#8080ff'),
>> 
>> auth.signature,singular="Evento",plural="Eventi",migrate='evento.table',
>> format='%(titolo)s')
>>
>> This is the grid
>>
>> form = SQLFORM.grid(query, args=[studente], fields=[db.evento.titolo, 
>> db.evento.giorno_inizio, db.evento.inizio, db.evento.fine, 
>> db.evento.risorsa, db.evento.materia, db.evento.docente],create=False, 
>> details=False, editable=False, deletable=False, searchable=False, 
>> maxtextlength=60, exportclasses = exportcls)
>>
>> ...but I see db.evento.giorno_inizio in english (like Monday, Tuesday, 
>> ecc.), but I want in italian? Hoe to do?
>> Thank you
>>
>
> I think the answer involves a represents clause and T(), but since I don't 
> yet have to support other-than-English, I am not able to go further.  But 
> look at the examples under
>  http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor
> >
>
>  /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.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: 403 Forbidden?

2017-05-06 Thread A.H.Gilbert
HI Erick,

Can't help BUT your post made me realise I had this problem after using
PythonAnywhere..

--
Best Wishes,
Howard

"If you don't read the newspaper, you're uninformed. If you read the
newspaper, you're mis-informed. - Mark Twain"


On Sat, May 6, 2017 at 8:33 AM, Dave S  wrote:

> On Friday, May 5, 2017 at 2:02:31 PM UTC-7, Erick R. wrote:
>>
>> Hello,
>>
>> I am having a similar problem with my admin page of my domain at
>> https://www.positivethoughtsdaily.com/admin. I initially accessed my
>> admin console and failed too many password attempts. Then I began seeing a
>> "Forbidden 403" page instead of the admin password entry page. I typically
>> access my admin page via the web2py interface through port 80. Here is what
>> I have tried so far:
>>
>>1. I contacted PythonAnywhere, my hosting service, and they provided
>>me with code to reset my admin password
>>. I did
>>this.
>>2. I removed and reinstalled web2py and updated to the latest version
>>as Howard did, but the "403 Forbidden" page is still there.
>>3. It has now been two days since I was initially locked out, so it
>>appears that waiting is not working either.
>>
>> Any suggestions to try next? Apologies if I am missing something simple
>> here.
>>
>> Thanks,
>> Erick
>>
>>
>
> Look for hosts.deny in the admin app  applications/admin/private/
> hosts.deny
>
> /dps
>
>
>> On Friday, April 21, 2017 at 11:08:07 AM UTC-5, Arthur Gilbert wrote:
>>>
>>> Thanks for reply Massimo and especial thanks for making all this
>>> available; I like it much better than Rails.
>>>
>>> I don't think failed logins was the problem.  I have now cured it by
>>> removing and re-installing web2py (after saving all the copies of my
>>> working though your lectures).
>>>
>>> --
>>> Best Wishes,
>>> Howard
>>>
>>> "If you don't read the newspaper, you're uninformed. If you read the
>>> newspaper, you're mis-informed. - Mark Twain"
>>>
>>>
>>> On Fri, Apr 21, 2017 at 4:39 PM, Massimo Di Pierro <
>>> massimo@gmail.com> wrote:
>>>
 You normally get that is you fail too many logins. It resets itself
 after 15 minutes.


 On Friday, 21 April 2017 10:12:52 UTC-5, Arthur Gilbert wrote:
>
>
> Just started web2py.  Going thro' Massimo di Pierro's 5 lectures on
> you tube.  Making good progress, excited about the system and everything
> working well.  BUT, when I went back to it, today, I clicked on Admin (of
> the welcome page) I got a long delay and then "403 FORBIDDEN". The page is
> showing "http://127.0.0.1:8000/admin/default/index"; as it should. I
> am not aware of changing anything on my system, I am using xubuntu and
> Firefox. Web2py version 2.14.6-stable+timestamp.2016.05.10.00.21.47.
>
> Please help,
> 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 a topic in the
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit https://groups.google.com/d/to
 pic/web2py/9T4E2MS8kfY/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> --
> 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/9T4E2MS8kfY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: 403 Forbidden?

2017-05-06 Thread Dave S
On Friday, May 5, 2017 at 2:02:31 PM UTC-7, Erick R. wrote:
>
> Hello,
>
> I am having a similar problem with my admin page of my domain at 
> https://www.positivethoughtsdaily.com/admin. I initially accessed my 
> admin console and failed too many password attempts. Then I began seeing a 
> "Forbidden 403" page instead of the admin password entry page. I typically 
> access my admin page via the web2py interface through port 80. Here is what 
> I have tried so far:
>
>1. I contacted PythonAnywhere, my hosting service, and they provided 
>me with code to reset my admin password 
>. I did 
>this.
>2. I removed and reinstalled web2py and updated to the latest version 
>as Howard did, but the "403 Forbidden" page is still there.
>3. It has now been two days since I was initially locked out, so it 
>appears that waiting is not working either.
>
> Any suggestions to try next? Apologies if I am missing something simple 
> here.
>
> Thanks,
> Erick
>
>

Look for hosts.deny in the admin app  
applications/admin/private/hosts.deny

/dps
 

> On Friday, April 21, 2017 at 11:08:07 AM UTC-5, Arthur Gilbert wrote:
>>
>> Thanks for reply Massimo and especial thanks for making all this 
>> available; I like it much better than Rails.  
>>
>> I don't think failed logins was the problem.  I have now cured it by 
>> removing and re-installing web2py (after saving all the copies of my 
>> working though your lectures).
>>
>> --
>> Best Wishes,
>> Howard
>>
>> "If you don't read the newspaper, you're uninformed. If you read the 
>> newspaper, you're mis-informed. - Mark Twain"
>>
>>
>> On Fri, Apr 21, 2017 at 4:39 PM, Massimo Di Pierro > > wrote:
>>
>>> You normally get that is you fail too many logins. It resets itself 
>>> after 15 minutes.
>>>
>>>
>>> On Friday, 21 April 2017 10:12:52 UTC-5, Arthur Gilbert wrote:


 Just started web2py.  Going thro' Massimo di Pierro's 5 lectures on you 
 tube.  Making good progress, excited about the system and everything 
 working well.  BUT, when I went back to it, today, I clicked on Admin (of 
 the welcome page) I got a long delay and then "403 FORBIDDEN". The page is 
 showing "http://127.0.0.1:8000/admin/default/index"; as it should. I am 
 not aware of changing anything on my system, I am using xubuntu and 
 Firefox. Web2py version 2.14.6-stable+timestamp.2016.05.10.00.21.47.

 Please help, 
 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 a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/9T4E2MS8kfY/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

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