I see the problem. Everything you have is correct but this, {{=BEAUTIFY
(row)}}, is meant to produce a crude representation, not a nice one.
You should replace it with {{=crud.read(db.companies,row)}} or even,
better, you can make your own custom representation, something like:
{{for field in db.companies.fields:}}
<b>{{=db.companies[field].label}}</b> : {{=row[field]}}<br/>
{{pass}}
On Oct 18, 9:48 pm, "hamdy.a.farag" <[email protected]> wrote:
> I'm making a profile to view companies that can be entered to the
> database
> and here's a part of my model (db.py)
>
> db.define_table("companies",
> Field("name", "string", requires=[IS_NOT_EMPTY(),
> IS_NOT_IN_DB(db, 'companies.name')]),
> Field("capital", "string", requires=IS_NOT_EMPTY()),
> Field("details", "text", requires=IS_NOT_EMPTY()),
> Field("emergence", "text", requires=IS_NOT_EMPTY()),
> Field("email", "string", requires=IS_EMAIL(),
> default="[email protected]"),
> Field("website", "string", requires=IS_URL(),
> default="www.company.com"),
> Field("userid", "string", requires=IS_IN_DB
> (db,'auth_user.email'), writable=False, readable=False),
> Field("sector_id","string",requires=IS_IN_DB
> (db,'sectors.id','%(name)s')),
> Field("tags", "string"),
> Field("logo","upload"),
> Field("homeImage","upload"),
> Field("dateAndTimeOfCreation", 'datetime',
> requires=IS_DATETIME(), default= datetime.datetime.today())
>
> ----
>
> my view has a part like that :
>
> <div id="tabs">
> <ul>
> <li><a href="#page-1"><span>profile</span></a></li>
> <li><a href="#page-2"><span>branchs</span></a></li>
> <li><a href="#page-3"><span>gallery</span></a></li>
> <li><a href="#page-4"><span>contact</span></a></li>
> </ul>
> <div id="page-1">
> {{=BEAUTIFY(row)}}
>
> the profile should display company info like that :
>
> capital : fdhfdh
> dateAndTimeOfCreation : datetime.datetime(2009, 10, 18, 14, 40, 57)
> .
> .
> userid : [email protected]
> website :http://www.company.com
>
> Can you see how the dateAndTimeOfCreation is displayed ?
> it's displayed as : datetime.datetime(2009, 10, 18, 14, 40, 57) and
> that's what I want to change
>
> I want it to be displayed without the prefix datetime.datetime
>
> I tried to edit the table in my (db.py) to make the last field look
> like :
>
> Field("dateAndTimeOfCreation", 'datetime', requires=IS_DATETIME(),
> default= str(datetime.datetime.today()))
>
> but this gave me an error
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---