[web2py] Re: weird database behavior

2011-12-11 Thread ニコノコ
I meant, if the data is accessed from a function.

On Dec 12, 12:07 pm, Anthony abasta...@gmail.com wrote:
 Can you show some code? What do you mean check the data from a view?







 On Sunday, December 11, 2011 8:43:50 PM UTC-5, ニコノコ wrote:

  I have a custom auth_user field that I could edit from admin (and I can
  verify that changes are actually written in the sqlite table) but every
  time I check the data from a view, the field value is always set to the
  initial default values, and not whatever's actually stored in the table.
  It's like the data is being retrieved from some cache I don't know about.

  I'm stumped. Has anyone experienced anything similar? This is the first
  time I encountered this. What gives?


[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread ニコノコ
SOrry, email editor mangled the text. SHould read:
db.table_settings['parent_table'].default_value.default


On Dec 12, 12:21 pm, Nik Go nikolai...@gmail.com wrote:
 db.table_settings.default_value.requires = IS_IN_SET(['a','b'])
 db.table_settings['parent_table'].default_value*.default*

 I think this is what you want, but make sure that you assign your
 validators first in your table_settings, because otherwise they're empty
 (or properly, None)







 On Monday, December 12, 2011, tsvim wrote:
  db.define_table('table_settings',
                  Field('name','string'),
                  Field('default_value','string'))

  db.define_table('data',

  Field('parent_table',db.table_settings,writable=False,readable=False),
                  Field('datetime','datetime',default=request.now),
                  Field('title','string'),
                  Field('value','string'))

  db.data.value.default = db.table_settings['parent_table'].default_value
  db.table_settings.default_value.requires = IS_IN_SET(['a','b'])


[web2py] Re: a couple of related questions

2011-10-23 Thread ニコノコ
Even if I'm logged in, I couldn't view a record when I click the
parent record. The parent field is a clickable representation viewable
in a grid.

re [2]
the relevant portion is the links parameter where I create a new
button. I want to create an icon for that button.


On Oct 23, 12:53 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 About [1] the user_signature=True is default but the signature only
 works if you are logged in.

 I do not understand [2]

 On Oct 20, 9:40 pm, niknok nikolai...@gmail.com wrote:







  I have a person table[1] with a parent field with a clickable
  representation view of the record. If I put this on a grid and click on
  the link, I get a not authorized error message. I thought I need to
  pass the signature so I can make it viewable. (This works fine if
  parameter user_signature=False)

  Also, I have defined a default representation for the person table but
  in my validation statement, note that I had to specify the same format
  again. I'm wondering if there's a way to tell the validator to use the
  default representation of the person (which I thought was web2py's
  default behavior.)

  In my grid, I specified a new button [2] in the links parameter, how do
  I specificy an icon for this button? For example I want to use what's
  already in base.css (book, heart, cross etc.)

  /r
  Nik

  [1]
  db.define_table('person'
                  ,Field('birth_date', 'date', requires=IS_DATE())
                  ,Field('last_name', notnull=True)
                  ,Field('given_name', notnull=True)
                  ,Field('parent', 'list:reference person'
                                  ,requires=IS_EMPTY_OR(IS_IN_DB(db, 
  'person.id'
                                                ,'%(last_name)s,
  %(given_name)s [%(birth_date)s]'
                                                ,multiple=True
                                                ,zero=T('pick one')))
                                  ,represent =  lambda value, row: [A(' ▸'+
  db.person[v].given_name , _href = URL('index/view/person', args=[v]))
  for v in value])
                  ,auth.signature
                  ,format='%(last_name)s, %(given_name)s [%(birth_date)s]'
                  )

  [2]
   form=SQLFORM.grid( db.person
                        ,fields=[db.person.id, db.person.last_name,
  db.person.given_name
                                      ,db.person.middle_name,
  db.person.gender, db.person.birth_date, db.person.parent]
                        ,showbuttontext=False
                        ,sorter_icons=('[▴]','[▾]')
                        ,onvalidation=person_processing
                        ,links = [lambda row: A('X',
  _href=URL(args=[view, db.person, row.id] ))]
                        )


[web2py] Re: SQLFORM.factory not respecting IS_NOT_EMPTY() for list:string?

2011-10-23 Thread ニコノコ
How about:  db.table.field.requires = IS_LENGTH(1)
On Oct 22, 12:35 am, TheSweetlink yanosh...@gmail.com wrote:
 I have a SQLFORM.factory that is respecting IS_NOT_EMPTY() for a field
 with type='string' but not respecting it for a diffirent field of
 type='list:string'.

 If the list:string type field is left empty the form validates.

 Confirmed with firebug.

 Tested with form.accepts, form.process(...).accepted, and
 form.validate.

 I tried removing all other conditions in the list:string field's
 requirements as well as setting it manually after the form is created
 with:

 form.element('#no_table_yayweb2py')['requires']=IS_NOT_EMPTY()

 The form uses an onvalidation= and again, it works for the plain
 string but not a field of list:string

 The form is validated no matter what I do.

 Your thoughts are most appreciated.

 David


[web2py] Re: grid custom button icons

2011-10-23 Thread ニコノコ

I create new buttons like this in the grid:
links = [lambda row: A('X', _href=URL(args=[view, db.person,
row.id] ))]

How should I specify an icon for the new button?

On Oct 19, 10:04 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Herehttps://github.com/michenriksen/css3buttonsyou can find a list of all
 suported classes for standard style,

 for the ui-icon option take a look at jquery-ui theme roller page


[web2py] Re: Complex CRUD Forms Examples with Web2py?

2011-10-23 Thread ニコノコ
Checkout the solidForm plugin from http://dev.s-cubism.com/web2py_plugins

On Oct 24, 4:18 am, BrendanC bren...@gmail.com wrote:
 Hi
 Some time ago I developed a CRUD demo app in Django that used some some
 complex forms. Here's an example:

 http://theludditegeek.com/prescreen/1

 I'd like to convert this to web2py. AFAIK the standard web2py forms/SQLform
 features (and related error handling) are based on the use of a single data
 element per row layout - which is very wasteful of screen real estate -
 especially if the form has a series of checkboxes for data input.  Are there
 any features in Web2py that help build more complex forms with non standard
 layouts (I'm thinking about possible error handling/error display issues
 here - I know I need to build the custom templates by hand).

 Interested to hear any comments/feedback as the only form  examples I can
 find are very basic (not real world).

 TIA,
 BrendanC


[web2py] Re: SQLFORM.factory not respecting IS_NOT_EMPTY() for list:string?

2011-10-23 Thread ニコノコ

not if the field is list:string

On Oct 24, 10:32 am, Vasile Ermicioi elff...@gmail.com wrote:
  How about:  db.table.field.requires = IS_LENGTH(1)

 that will limit the field to one character, not to one value from set


[web2py] Re: SQLFORM.factory not respecting IS_NOT_EMPTY() for list:string?

2011-10-23 Thread ニコノコ
Eeugh. Sorry for the ugly suggestion. Post validation could

def person_processing(form):

if len(form.vars.field or '')1:
form.errors.field= 'Select one.'



On Oct 24, 10:32 am, Vasile Ermicioi elff...@gmail.com wrote:
  How about:  db.table.field.requires = IS_LENGTH(1)

 that will limit the field to one character, not to one value from set