[web2py] Can I change the color of the cursor on the web2py editor

2011-08-02 Thread dorasan
Hello everyone

I want to change the color of the cursor on the web2py editor.
It is very light gray and sometimes it's hard to find the cursor on
the editor because of sunlight shining on the display.
Ive found the definition of the line color which the cursor exists in
edit_area_full.js but I still don't know how to change the color of
the cursor.

Plese help me.

Dora


[web2py] How to create a new record in database without submit buttons

2011-07-02 Thread dorasan
Hello everyone.

Could you tell me how to create a new record in database without
submit buttons?
I actually would like to do it by the onclick event.
I know that I can call the ajax function like this.

  input name=name onClick=ajax('writing', ['title'], 'target') /

But I dont know what I have to write in the 'def:writing'.
My code implemented by a submit button is this.

db.py
db.define_table('article',
   Field('title'),
   Field('text')
   )

post.py
def writing():
  form = SQLFORM(db.article)
  if form.accepts(request.vars, session, formname='article_works'):
  response.flash = 'Done'
  elif form.errors:
  response.flash = 'Error'
  else:
  response.flash = 'Write something'
  return dict(formkeyvalue=form.formkey, message=response.flash)

post/writing.html
{{include 'web2py_ajax.html'}}
form id='articlepost'
divTitleinput name='title' //div
divText/divtextarea name='text'/textarea
input type=submit /
input value={{=formkeyvalue}} type=hidden name=_formkey /
input type=hidden name=_formname value=article_works /
/form
{{=message}}


[web2py] how to round the number of seconds

2011-06-25 Thread dorasan
Hello everyone.

Could you tell me how to round the number of seconds which
'request.now' represents like this

'2011-06-25 15:26:55.881000'   =  '2011-06-25 15:26:55' or
'2011-06-25 15:26:56'

thank you

dorasan


[web2py] About back-references in the google datastore API

2011-06-18 Thread dorasan
Hello dear teachers.
I'm a new to web2py and this community.

I would like to know that how to write back-references using
datastore API.
Although I'm actually new to datastore API too, I know that there is a
way to get entities which refer to the particular entity like this
way.

-
class FirstModel(db.Model):
prop = db.IntegerProperty()

class SecondModel(db.Model):
reference = db.ReferenceProperty(FirstModel)

obj1 = FirstModel()
for obj in obj1.secondmodel_set

this code is from 
http://code.google.com/intl/en/appengine/docs/python/datastore/datamodeling.html

I would like to do this on web2py.


Dorasan.