[web2py] Re: A newbie question about update_or_insert

2013-11-06 Thread Andreas Wienes
I get the point. Thanks for your quick reply!

- Andreas

Am Mittwoch, 6. November 2013 23:44:14 UTC+1 schrieb Cliff Kachinske:
>
> form.process does the insertion, so your call to update_or_insert is too 
> late.
>
> how about this?
> db.define_table('name' Field('name', unique=True, requires=IS_NOT_IN_DB(...
>
> Look in the "Forms and Validators" chapter of the online manual for the 
> correct syntax for IS_NOT_IN_DB.
> Look in the "Database Abstraction Layer" chapter for more information 
> about the arguments to Field.
>
> On Wednesday, November 6, 2013 5:20:33 PM UTC-5, Andreas Wienes wrote:
>>
>> I want to use update_or_insert to insert a value to my DB if it doesn't 
>> exist.
>>
>> def add_name():
>> form = SQLFORM(db.name)
>> if form.process().accepted:
>> db.name.update_or_insert(db.name.name==request.vars.name, name=
>> request.vars.name)
>> return dict(form=form)
>>
>>
>> But it won't work. Names are also added to the DB, even if they already 
>> there. 
>>
>> Thanks for your help!
>>
>> - Andreas
>>
>

-- 
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/groups/opt_out.


[web2py] A newbie question about update_or_insert

2013-11-06 Thread Andreas Wienes
I want to use update_or_insert to insert a value to my DB if it doesn't 
exist.

def add_name():
form = SQLFORM(db.name)
if form.process().accepted:
db.name.update_or_insert(db.name.name==request.vars.name, 
name=request.vars.name)
return dict(form=form)


But it won't work. Names are also added to the DB, even if they already 
there. 

Thanks for your help!

- Andreas

-- 
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/groups/opt_out.


[web2py] Re: How to use response.flash() to inform user about current status of a process

2013-11-06 Thread Andreas Wienes
Thanks for your advice Niphlod. I will try it soon and report my results.

- Andreas

Am Sonntag, 3. November 2013 16:28:37 UTC+1 schrieb Niphlod:
>
> response.flash is used to set a fixed content into the layout.html
> This happens to be a  in the scaffolding app.
> That being said, you can't update the contents without refreshing the 
> page, and / or using ajax. 
> The implementation relies entirely on how your app works (i.e. how the 
> page fetches the "progress" of the "process steps").
> web2py.js has a js function to update the contents of the flash message 
> and to display it (because usually it's hidden).
> try 
> $.web2py.flash(message, status)
>
> it will insert "message" into the flash and add "status" classes to the 
> corresponding div.
>
>
>
>
> On Sunday, November 3, 2013 1:37:26 PM UTC+1, Andreas Wienes wrote:
>>
>> Hello,
>>
>> I try to use response.flash() to inform my users whats happening on my 
>> website. Is there a way to quick update the displayed message?
>>
>> Example:
>> User clicks on a button, response.flash() informs about the start of a 
>> process.
>> The user waits, response.flash() informs about several process steps and 
>> after the process has finished, the response.flash() informs about the 
>> result of the process.
>>
>> Or is there a better way instead using response.flash()
>>
>> Best regards
>> - Andreas
>>
>

-- 
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/groups/opt_out.


[web2py] How to use response.flash() to inform user about current status of a process

2013-11-03 Thread Andreas Wienes
Hello,

I try to use response.flash() to inform my users whats happening on my 
website. Is there a way to quick update the displayed message?

Example:
User clicks on a button, response.flash() informs about the start of a 
process.
The user waits, response.flash() informs about several process steps and 
after the process has finished, the response.flash() informs about the 
result of the process.

Or is there a better way instead using response.flash()

Best regards
- Andreas

-- 
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/groups/opt_out.


[web2py] Re: web2py resources

2013-10-31 Thread Andreas Wienes
Thanks for your feedback. I'll check the different Mercurial guides and 
update my website, if I find a better solution.

-- 
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/groups/opt_out.


[web2py] Re: change_password and logout redirects to user/profile and leads to too many redirects

2013-10-30 Thread Andreas Wienes
I finally found a solution. It's like Jonathan Lundell explained in this 
thread https://groups.google.com/forum/#!topic/web2py/LUCVm9pKX28:

The normal call, form=auth(), is dynamic (see Auth.__call__), and returns 
> the form that's appropriate to the request URL. Auth.register() does a 
> redirect to profile if the user is logged in.
>

Now I could work around this problem. Maybe it's a good idea to mention 
this in the documentation and to make this behavior configurable.

-- 
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/groups/opt_out.


[web2py] Re: change_password and logout redirects to user/profile and leads to too many redirects

2013-10-30 Thread Andreas Wienes
Still in trouble with this issue. :-(

-- 
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/groups/opt_out.


[web2py] Re: Many to many

2013-10-30 Thread Andreas Wienes
I'm not sure if I understand you right. What do you mean with "category"? 
Maybe you could try this to get all images with a specific gallery-id:

images = db(db.int_table_galleries_images.gallery.id==1).select()
return dict(images=images)


- Andreas

Am Mittwoch, 30. Oktober 2013 11:51:19 UTC+1 schrieb Gael Princivalle:
>
>
> Hi.
>
> I'm still making a website where I'm gone have to manage a lot of little 
> image galleries.
> An image could be shown inside more galleries, galleries have many images, 
> so my relation is "many to many".
>
> Here is my db:
> db.define_table('images',
> Field('title_en'),
> Field('title_it'),
> Field('contents'),
> Field('image_file', 'upload'),
> Field('image_file_s', 'upload'))
> db.define_table('galleries',
> Field('title_en'),
> Field('title_it'))
> db.define_table('int_table_galleries_images',
> Field('gallery', 'reference galleries'),
> Field('image', 'reference images'))
>
> Now in the company page, I want to show only images from the "1" category.
>
> In the controller:
> def company():
> gallery_company = ?
> return dict(gallery_company=gallery_company)
>
> How can I select all fields from images and galleries where galleries.id==1  
> ?
>
> 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.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py resources

2013-10-29 Thread Andreas Wienes
This could help for the very first orientation http://learn-web2py.com/.

-- 
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/groups/opt_out.


[web2py] Re: Best way to learn web2py

2013-10-28 Thread Andreas Wienes
I published http://learn-web2py.com a few minutes ago. It's far away from 
being perfect, but it's an first attempt. I'm neither an expert in web2py 
nor a native speaker. All of your feedback is welcome!

- Andreas

-- 
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/groups/opt_out.


[web2py] Re: Best way to learn web2py

2013-10-26 Thread Andreas Wienes
Thanks for all of your feedback. I've also started using web2py about two 
months ago and felt in love with it. It's so clear, simple to use, very 
well documented and the community is awesome. I'm grateful for the 
development and the quick and friendly support. But although all of this 
exists, there is still something missing in the web2py-universe. From my 
point of view, it's still too unpopular and doesn't seems so cool and 
"fancy"as it should. As a result of this, web2py isn't well know and there 
are still to less job offers for web2py developers. Most offers are for 
Rails or Django developers. I'm living in Germany and this is just my point 
of view. Hopefully the job market and spreading of web2py is better in your 
country.

I think, if we wanna try to become web2py more popular and to increase the 
job opportunities, we need to make it more 
attractive. http://killer-web-development.com/ is a good approach doing 
this. The rails-world is full of pages like this. Most of you know 
Railscast and stuff like Rails for zombies. I tried Rails, because it's 
popularity and shiny community. But at the end I was frustrated about all 
the magic, different ways of solving problems and hidden complexity. 
Exploring web2py gave me new hope and web development was funny again. 
Let's add some shine and coolness to it and it could be nearly perfect.  

A page like "the best way to learn web2py" could help to reach more people 
and let our community grow. 

I collected some material and made a first draft using 
Evernote. 
https://www.evernote.com/shard/s137/sh/9248dc08-d669-4b03-beb5-e3dcddc7e66b/f65523796758735f6d58dd8c31246ad5
My next steps would be to collect something more, write some short 
descriptions and start a simple wordpress based website. Every kind of help 
and productive criticism is welcome.

- Andreas

-- 
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/groups/opt_out.


[web2py] Best way to learn web2py

2013-10-23 Thread Andreas Wienes
Hey guys,

I think it would be great to start a website similar to 
http://astonj.com/tech/best-way-to-learn-ruby-rails/ but only for web2py.

So what do you think about my idea and what is your opinion about the "best 
way" to learn web2py? 

I'm excited for your suggestions.

- Andreas

-- 
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/groups/opt_out.


[web2py] Re: change_password and logout redirects to user/profile and leads to too many redirects

2013-10-23 Thread Andreas Wienes
Thank you Massimo, I've sent you an email.


Am Mittwoch, 23. Oktober 2013 00:36:37 UTC+2 schrieb Massimo Di Pierro:
>
> Please make a minimalist app to reproduce and post it or email it to me.
>
> On Saturday, 19 October 2013 11:25:34 UTC-5, Andreas Wienes wrote:
>>
>>
>> Hey guys,
>>
>> I'm using web2py 2.7.4 and get some strange behavior with some redirects. 
>>
>> If I click on "change password" in the user navbar I want to get redirect 
>> to "/default/user/change_password" instead I get redirected to 
>> "/default/user/profile". It's the same for the logout link and it seems the 
>> problem happens for all links containing "user". Finally my browser is 
>> telling me, that there ar too many redirects.
>>
>> I modified the user() method in this way:
>>
>> def user():
>> login_form=auth.login()
>> register_form=auth.register()
>> reset_password_form=auth.request_reset_password()
>> return locals()
>>
>> This is were I want to go by following the link:
>>
>> def edit_profile():
>> user_form = auth.profile(onaccept=lambda user_form: 
>> update_skills_and_cities())
>> user = auth.user
>> user_links=db(db.link.user_id==user.id).select()
>> return locals()
>> (There is no auth.requires_login() in front of it.)
>>
>> This is the content of user.html:
>>
>> {{extend 'layout.html'}}
>>
>> {{if request.args(0)=='request_reset_password':}}
>> {{=reset_password_form}}
>>
>> {{elif request.args(0)=='change_password':
>> ...
>> }}
>>
>> {{elif request.args(0)=='logout':
>> auth.logout()
>> }}
>>
>> {{elif request.args(0)=='profile':}}
>> 
>>
>> {{elif request.args(0)=='register' or request.args(0)=='login':}}
>> 
>>
>> {{else:}}
>> redirect(URL('default', 'index'))
>> {{pass}}
>>
>> In db.py I got the following settings:
>>
>> auth.settings.login_next = URL('index')
>> auth.settings.logout_next = URL('index')
>> auth.settings.profile_next = URL('index')
>> auth.settings.register_next = URL('user', args='login')
>> auth.settings.retrieve_username_next = URL('index')
>> auth.settings.retrieve_password_next = URL('index')
>> auth.settings.change_password_next = URL('index')
>> auth.settings.request_reset_password_next = URL('user', args='login')
>> auth.settings.reset_password_next = URL('user', args='login')
>> auth.settings.verify_email_next = URL('user', args='login')
>>
>>
>> I already cleaned my browser cache and also restarted my browser and 
>> web2py.
>>
>> Hope you can help me with this issue.
>>
>> - Andreas
>>
>

-- 
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/groups/opt_out.


[web2py] Re: change_password and logout redirects to user/profile and leads to too many redirects

2013-10-22 Thread Andreas Wienes
No ideas?

-- 
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/groups/opt_out.


[web2py] change_password and logout redirects to user/profile and leads to too many redirects

2013-10-19 Thread Andreas Wienes

Hey guys,

I'm using web2py 2.7.4 and get some strange behavior with some redirects. 

If I click on "change password" in the user navbar I want to get redirect 
to "/default/user/change_password" instead I get redirected to 
"/default/user/profile". It's the same for the logout link and it seems the 
problem happens for all links containing "user". Finally my browser isi 
telling me, that there ar to many redirects.

I modified the user() method in this way:

def user():
login_form=auth.login()
register_form=auth.register()
reset_password_form=auth.request_reset_password()
return locals()

This is were I want to go by following the link:

def edit_profile():
user_form = auth.profile(onaccept=lambda user_form: 
update_skills_and_cities())
user = auth.user
user_links=db(db.link.user_id==user.id).select()
return locals()
(There is no auth.requires_login() in front of it.)

This is the content of user.html:

{{extend 'layout.html'}}

{{if request.args(0)=='request_reset_password':}}
{{=reset_password_form}}

{{elif request.args(0)=='change_password':
...
}}

{{elif request.args(0)=='logout':
auth.logout()
}}

{{elif request.args(0)=='profile':}}


{{elif request.args(0)=='register' or request.args(0)=='login':}}


{{else:}}
redirect(URL('default', 'index'))
{{pass}}

In db.py I got the following settings:

auth.settings.login_next = URL('index')
auth.settings.logout_next = URL('index')
auth.settings.profile_next = URL('index')
auth.settings.register_next = URL('user', args='login')
auth.settings.retrieve_username_next = URL('index')
auth.settings.retrieve_password_next = URL('index')
auth.settings.change_password_next = URL('index')
auth.settings.request_reset_password_next = URL('user', args='login')
auth.settings.reset_password_next = URL('user', args='login')
auth.settings.verify_email_next = URL('user', args='login')


I already cleaned my browser cache and also restarted my browser and web2py.

Hope you can help me with this issue.

- Andreas

-- 
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/groups/opt_out.


[web2py] Re: Change target of "edit profile" link permanently

2013-10-18 Thread Andreas Wienes
$('div').find('a:contains("Profile")').attr("href", "new_target");
$('div').find('a:contains("Profile")').replaceWith(" new linktext ");


Both worked for me.


-- 
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/groups/opt_out.


[web2py] Re: Change target of "edit profile" link permanently

2013-10-18 Thread Andreas Wienes
Sorry for the lack of information. Yes I'm talking about the link produced 
by auth.navbar(). Thanks for your help Anthony.

- Andreas

-- 
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/groups/opt_out.


[web2py] Change target of "edit profile" link permanently

2013-10-18 Thread Andreas Wienes
What is the best way to change the target of the "edit profile" 
link permanently?

Thanks for your help!
Andreas

-- 
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/groups/opt_out.


Re: [web2py] resizing inputbox without javacsript

2013-10-10 Thread Andreas Wienes
Hello Ricardo,

this works like a charm. :-) Thanks a lot! 
Where can I look up such information? I didn't found it in the web2py book. 

Best regards
Andreas


Am Donnerstag, 10. Oktober 2013 21:58:42 UTC+2 schrieb Ricardo Pedroso:
>
> On Thu, Oct 10, 2013 at 5:50 PM, Andreas Wienes 
> 
> > wrote:
>
>>
>> Because I'm not very familar in using JavaScript and don't like the idea 
>> to use it for formating more than one inputbox, I hope there is another 
>> cleaner and easier way doing this. Maybe with parameters like 
>> {{=register_form.custom.widget.first_name, 
>> _size='124px'}}
>>
>>
> try this:
>
> {{register_form.custom.widget.first_name.attributes['_style'] = "width: 
> 124px"}} 
> {{=register_form.custom.widget.first_name}} 
>
>
>

-- 
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/groups/opt_out.


[web2py] Re: Does your Response Flash get in the way?

2013-10-10 Thread Andreas Wienes
Is Annet's solution still the best way handling flash messages?

-- 
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/groups/opt_out.


[web2py] resizing inputbox without javacsript

2013-10-10 Thread Andreas Wienes
I know this has been asked serveral times before, but I couldn't find a 
working solution for me.

I use the auth.login() and auth.register() forms to build a login screen 
similar to twitter. I'm doing this with the following lines of code:

{{=login_form.custom.begin}}
{{=login_form.custom.widget.email}}
 {{=login_form.custom.widget.password}}
 {{=login_form.custom.submit}}
{{=login_form.custom.end}}

{{=register_form.custom.begin}}
  {{=register_form.custom.widget.first_name}}
  {{=register_form.custom.widget.last_name}}
  {{=register_form.custom.widget.email}}
  {{=register_form.custom.widget.password}}
  {{=register_form.custom.submit}}
{{=register_form.custom.end}}

After creating the form I use JavaScript to resize and format the 
inputboxes:


  
jQuery(document).ready(function(){jQuery('[id^=auth_user]').css('width','265px')});
  
jQuery(document).ready(function(){jQuery('#auth_user_first_name').css('width','124px')});
  
jQuery(document).ready(function(){jQuery('#auth_user_last_name').css('width','124px').css('margin-left','-5px')});
  
jQuery(document).ready(function(){jQuery('#auth_user_password').css('width','198px').css('float','left')});
  
jQuery(document).ready(function(){jQuery('[name=password]:eq(1)').css('width','180px').css('float','left')});
  
jQuery(document).ready(function(){jQuery('#auth_user_remember').css('width','12px')});


Because I'm not very familar in using JavaScript and don't like the idea to 
use it for formating more than one inputbox, I hope there is another 
cleaner and easier way doing this. Maybe with parameters like 
{{=register_form.custom.widget.first_name, 
_size='124px'}}

Thanks for your help!
Andreas

-- 
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/groups/opt_out.


[web2py] Re: How to program a form for one to many relations?

2013-10-02 Thread Andreas Wienes
Yeah but this isn't cool if I use further database queries.

-- 
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/groups/opt_out.


[web2py] How to program a form for one to many relations?

2013-10-02 Thread Andreas Wienes
Hey guys,

in the web2py-book is an example for a one-to-many relation. 
http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#One-to-many-relation

db.define_table('person',
   Field('name'),
   format='%(name)s')

db.define_table('thing',
   Field('name'),
   Field('owner_id', 'reference person'),
   format='%(name)s')

My question is, how would a form look, in which the user enters the persons 
name and several things, which belongs to this person?

I could collect all things in a textbox as a string, split this string into 
single parts and insert each into the things table, but this seems a bit 
too complicated. 

All the best 
Andreas

-- 
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/groups/opt_out.


[web2py] Re: little problem with custom edit_profile method

2013-10-01 Thread Andreas Wienes
Thanks for your advice Anthony. I really appreciate the web2py-community 
for it's quick and kind support!

-- 
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/groups/opt_out.


[web2py] Please vote for web2py support in Dash

2013-10-01 Thread Andreas Wienes
Hey guys,

I'm using a Mac app called "dash" (http://kapeli.com/dash)  for a quick 
acces to offline documentation. Web2py is unfortunatly not currently not 
included, but the author has promissed to create a documentation, if enough 
people would ask him. 

Maybe you are also interessted in this idea and want to help to reach more 
people with this awesome framework. I would appreciate if you write an 
short email via http://kapeli.com/contact. 

Thanks for your support!

Best regards
Andreas

-- 
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/groups/opt_out.


[web2py] Re: little problem with custom edit_profile method

2013-10-01 Thread Andreas Wienes
Thanks Niphlod, 

that helped me a lot.

Am Montag, 30. September 2013 23:09:29 UTC+2 schrieb Niphlod:
>
> auth.profile() calls accepts() by itself, you can't re-process() it.
> see the signature of auth.profile for further methods (i.e. you could use 
> onvalidation) or make your own form.
>
> On Monday, September 30, 2013 10:28:08 PM UTC+2, Andreas Wienes wrote:
>>
>> I want to execute some code, after updating a user profile. So I created 
>>  a method edit_profile inside default.py
>>
>> def edit_profile():
>> user_form = auth.profile()
>> if user_form.process().accepted:
>> # ... do something here ...
>> redirect(URL('default','index'))
>> return dict(user_form=user_form)
>>
>> After clicking the submit button, I get redirect, but the changes won't 
>> be saved. Any idea what's wrong with my code?
>>
>> All the best
>> Andreas
>>
>

-- 
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/groups/opt_out.


[web2py] little problem with custom edit_profile method

2013-09-30 Thread Andreas Wienes
I want to execute some code, after updating a user profile. So I created  a 
method edit_profile inside default.py

def edit_profile():
user_form = auth.profile()
if user_form.process().accepted:
# ... do something here ...
redirect(URL('default','index'))
return dict(user_form=user_form)

After clicking the submit button, I get redirect, but the changes won't be 
saved. Any idea what's wrong with my code?

All the best
Andreas

-- 
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/groups/opt_out.


[web2py] Re: Perform checks before showing a form to the user

2013-09-24 Thread Andreas Wienes
Awesome and so beautiful. Thank you so much!

Am Dienstag, 24. September 2013 21:39:35 UTC+2 schrieb Massimo Di Pierro:
>
> perhaps this way:
>
> project = db.project(request.args(0,cast=int))
> step = db.project_step(request.args(1,cast=int))
>
> if not project:
> url = URL('default', 'index')
> elif auth.user_id != project.created_by or not step:
> url = URL('project', 'show', args=request.args(0)
> else:
> url = None
> tender_form = SQLFORM(db.tender)
> if url:
> session.flash = T('Something went wrong.')
> redirect(url)
>
>
> On Tuesday, 24 September 2013 04:04:44 UTC-5, Andreas Wienes wrote:
>>
>> Hey guys,
>>
>> in my current project I need to perform some checks before showing a form 
>> to the user. I'm not sure if I've done this in the best possible way. It 
>> looks a bit complicated to me.  
>>
>> project = db.project(request.args(0))
>> step = db.project_step(request.args(1))
>>
>> # Is the project existing?
>> if project:
>> # Is the current logged in user the owner of the project?
>> if auth.user_id == project.created_by:
>> # Is the step, we want to work with, existing?
>> if step:
>> tender_form = SQLFORM(db.tender)   
>> else:
>> session.flash = T('Something went wrong.')
>> redirect(URL('project', 'show', args=request.args(0)))
>> else:
>> session.flash = T('Something went wrong.')
>> redirect(URL('project', 'show', args=request.args(0)))
>> else:
>> session.flash = T('Something went wrong.')
>> redirect(URL('default', 'index'))
>>
>>
>> I got three IFs what doesn't look elegant for me. Is it possible to 
>> combine the IF project and IF step statements?
>>
>> Thanks for your help
>> Andreas
>>
>

-- 
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/groups/opt_out.


[web2py] Perform checks before showing a form to the user

2013-09-24 Thread Andreas Wienes
Hey guys,

in my current project I need to perform some checks before showing a form 
to the user. I'm not sure if I've done this in the best possible way. It 
looks a bit complicated to me.  

project = db.project(request.args(0))
step = db.project_step(request.args(1))

# Is the project existing?
if project:
# Is the current logged in user the owner of the project?
if auth.user_id == project.created_by:
# Is the step, we want to work with, existing?
if step:
tender_form = SQLFORM(db.tender)   
else:
session.flash = T('Something went wrong.')
redirect(URL('project', 'show', args=request.args(0)))
else:
session.flash = T('Something went wrong.')
redirect(URL('project', 'show', args=request.args(0)))
else:
session.flash = T('Something went wrong.')
redirect(URL('default', 'index'))


I got three IFs what doesn't look elegant for me. Is it possible to combine 
the IF project and IF step statements?

Thanks for your help
Andreas

-- 
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/groups/opt_out.


[web2py] Re: Upload file using POST

2013-09-19 Thread Andreas Wienes
Okay that worked for me. Thanks for your advice!

-- 
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/groups/opt_out.


[web2py] Re: Upload file using POST

2013-09-18 Thread Andreas Wienes
Hello Massimo,

thanks for your reply. I try to record audio using jRecorder (
https://github.com/sythoos/jRecorder/blob/master/html/example1.html) in one 
of my apps. The recorded file should be saved on the server. I assume I 
have to post the file to the server because there is the line 
'http://yourdomain.com/acceptfile.php?filename=hello.wav' , //replace with 
your server path please in the script.

All the best
Andreas


Am Mittwoch, 18. September 2013 20:56:01 UTC+2 schrieb Massimo Di Pierro:
>
> You cannot upload a file using GET variables. It must be done using POST 
> multipart forms. Can you explain better your workflow?
>
> On Wednesday, 18 September 2013 12:32:27 UTC-5, Andreas Wienes wrote:
>>
>> Hello,
>>
>> I want to upload a file by posting it from another script calling 
>> something like http://mydomain.com/default/acceptfile?filename=test.txt
>> What is the easiest way doing this?
>>
>> Thanks a lot for your help!
>> Andreas
>>
>

-- 
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/groups/opt_out.


[web2py] Upload file using POST

2013-09-18 Thread Andreas Wienes
Hello,

I want to upload a file by posting it from another script calling something 
like http://mydomain.com/default/acceptfile?filename=test.txt
What is the easiest way doing this?

Thanks a lot for your help!
Andreas

-- 
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/groups/opt_out.


Re: [web2py] Recording audio through web browser

2013-09-17 Thread Andreas Wienes
What I mean is to record audio through the browser using the build in 
microphone. Imagine you visit a website and are able to record your own 
voice.

Am Dienstag, 17. September 2013 23:23:18 UTC+2 schrieb Richard:
>
> what do you mean?
>
> Record a online radio stream?
>
> There is downloadhelper extension for firefox that can help download 
> youtube or other media : 
> https://addons.mozilla.org/fr/firefox/addon/video-downloadhelper/
>
> About recording audio stream I don't know there is surely a solution, but 
> I only had works with podcast or that kind of stuff. 
>
> Richard
>
>
> On Tue, Sep 17, 2013 at 4:17 PM, Andreas Wienes 
> 
> > wrote:
>
>> Hey guys,
>>
>> do you know a way to record audio files through the web browser?
>>
>> Best regards
>> Andreas
>>  
>> -- 
>> 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/groups/opt_out.
>>
>
>

-- 
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/groups/opt_out.


[web2py] Recording audio through web browser

2013-09-17 Thread Andreas Wienes
Hey guys,

do you know a way to record audio files through the web browser?

Best regards
Andreas

-- 
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/groups/opt_out.


[web2py] Re: Is there an easy way to list all my 2Do's in a project?

2013-09-14 Thread Andreas Wienes
I found a great solution called SublimeTODO. Read more about it here 
https://github.com/robcowie/SublimeTODO

-- 
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/groups/opt_out.


Re: [web2py] Is there an easy way to list all my 2Do's in a project?

2013-09-14 Thread Andreas Wienes
Hello Ramos,

that's not exactly what I'm looking for, but I will try it out. Thanks for 
your help!


Am Samstag, 14. September 2013 19:10:16 UTC+2 schrieb Ramos:
>
> install PlainTask for sublime. Look in youtube for a tutorial
>
>
>
> 2013/9/14 Andreas Wienes >
>
>> Hey guys,
>>
>> I know it's no web2py related question, but maybe someone of you got a 
>> clue. I'm working with Sublimetext and comment my next targets with # 2Do. 
>>
>> Do you know an easy way to list all my 2Do's ?   
>>
>>
>> Thanks
>> Andreas
>>
>> -- 
>> 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/groups/opt_out.
>>
>
>

-- 
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/groups/opt_out.


[web2py] Is there an easy way to list all my 2Do's in a project?

2013-09-14 Thread Andreas Wienes
Hey guys,

I know it's no web2py related question, but maybe someone of you got a 
clue. I'm working with Sublimetext and comment my next targets with # 2Do. 

Do you know an easy way to list all my 2Do's ?   


Thanks
Andreas

-- 
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/groups/opt_out.


[web2py] Re: Question about basic concept of controllers

2013-09-13 Thread Andreas Wienes
Okay good to know. Thanks!

Am Freitag, 13. September 2013 14:34:33 UTC+2 schrieb Anthony:
>
> Also, note that one advantage of having a "default" controller (which 
> doesn't necessarily have to be named default.py) is that you can use the 
> URL rewrite system to exclude that controller name from URLs, making your 
> URLs a little shorter/cleaner. You can also exclude a default function 
> within each controller. So, instead of /myapp/default/index, you would just 
> have /myapp.
>
> Anthony
>
> On Friday, September 13, 2013 8:14:17 AM UTC-4, Niphlod wrote:
>>
>> a controller is just a file. That file holds every function that 
>> "generate" a page.
>> That being said, it's just how you lay out your url-scheme that usually 
>> decides what controller to use:
>>
>> /appname/controllername/functioname
>>
>> in the end is the url where to retrieve the infos.
>>
>> On Friday, September 13, 2013 1:56:39 PM UTC+2, Andreas Wienes wrote:
>>>
>>> Hey guys,
>>>
>>> this is maybe a dumb question, but I'm asking myself, when I should use 
>>> other controllers the "default.py". In the tutorials and the web2py-book 
>>> the default-controller is used most of the time and every action is placed 
>>> inside it. I assume to split my code into logical parts, so if I work with 
>>> "project", "task" and "client" for instance, I have one controller for each 
>>> of them, containing there relevant actions. Am i right?
>>>
>>> Again thanks for your help.
>>> Andreas
>>>
>>

-- 
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/groups/opt_out.


[web2py] Re: Question about basic concept of controllers

2013-09-13 Thread Andreas Wienes
Thanks, that answers my question.

Am Freitag, 13. September 2013 14:14:17 UTC+2 schrieb Niphlod:
>
> a controller is just a file. That file holds every function that 
> "generate" a page.
> That being said, it's just how you lay out your url-scheme that usually 
> decides what controller to use:
>
> /appname/controllername/functioname
>
> in the end is the url where to retrieve the infos.
>
> On Friday, September 13, 2013 1:56:39 PM UTC+2, Andreas Wienes wrote:
>>
>> Hey guys,
>>
>> this is maybe a dumb question, but I'm asking myself, when I should use 
>> other controllers the "default.py". In the tutorials and the web2py-book 
>> the default-controller is used most of the time and every action is placed 
>> inside it. I assume to split my code into logical parts, so if I work with 
>> "project", "task" and "client" for instance, I have one controller for each 
>> of them, containing there relevant actions. Am i right?
>>
>> Again thanks for your help.
>> Andreas
>>
>

-- 
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/groups/opt_out.


[web2py] Question about basic concept of controllers

2013-09-13 Thread Andreas Wienes
Hey guys,

this is maybe a dumb question, but I'm asking myself, when I should use 
other controllers the "default.py". In the tutorials and the web2py-book 
the default-controller is used most of the time and every action is placed 
inside it. I assume to split my code into logical parts, so if I work with 
"project", "task" and "client" for instance, I have one controller for each 
of them, containing there relevant actions. Am i right?

Again thanks for your help.
Andreas

-- 
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/groups/opt_out.


[web2py] Re: Table field isn't set to be unique, but results in error "title is not unique"

2013-09-12 Thread Andreas Wienes
Thanks a lot Bruno. That worked for me.

-- 
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/groups/opt_out.


[web2py] Table field isn't set to be unique, but results in error "title is not unique"

2013-09-12 Thread Andreas Wienes
Hi,

I got a problem with one of my database tables. The field 'title' isn't set 
to be unique. But inserting a row using filter_fields() ends with error 
"title is not unique".

db.define_table('task',
   Field('title', unique=False),
   Field('description', 'text', notnull=True),
 format='%(title)s')

db.define_table('step',
   Field('title'),
   Field('description', 'text', notnull=True),
   format='%(title)s')

db.task.insert(**db.task._filter_fields(step))

 column title is not unique

Any help would be great!

- Andreas

-- 
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/groups/opt_out.


[web2py] Re: Please help me to design my database structure

2013-09-10 Thread Andreas Wienes
Each steps from table project_type_step should be copied to table 
project_step, after creating a new project through the form.

Am Dienstag, 10. September 2013 11:16:33 UTC+2 schrieb Luc Chase:
>
> You want to copy all the steps... then mark each as it is done? Or are you 
> wanting to create each done project_step record only after it is done?
>
>
>
> On Tuesday, 10 September 2013 00:02:40 UTC+1, Andreas Wienes wrote:
>>
>> Thanks for your advice! I corrected the small error and created the new 
>> table. Now I'm trying to copy the steps for a specific project_type to a 
>> new created project.
>>
>> I tried the following:
>>
>> def start():
>> form = SQLFORM(db.project).process()
>> if form.accepted:
>> project_type = form.vars.project_type
>> for row in db(db.step.project_type_id==project_type).select():
>> # copy each step to the project_step table
>>
>> redirect(URL('index', args=form.vars.project_type))
>> return locals()
>>
>> But I don't know how to copy from one table to another. Any ideas?
>>
>>

-- 
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/groups/opt_out.


[web2py] Re: Please help me to design my database structure

2013-09-09 Thread Andreas Wienes
Thanks for your advice! I corrected the small error and created the new 
table. Now I'm trying to copy the steps for a specific project_type to a 
new created project.

I tried the following:

def start():
form = SQLFORM(db.project).process()
if form.accepted:
project_type = form.vars.project_type
for row in db(db.step.project_type_id==project_type).select():
# copy each step to the project_step table

redirect(URL('index', args=form.vars.project_type))
return locals()

But I don't know how to copy from one table to another. Any ideas?

-- 
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/groups/opt_out.


[web2py] Please help me to design my database structure

2013-09-09 Thread Andreas Wienes
Hello,

I've three models called project, project_type and steps.

A project belongs to a certain project_type and depending on what kind of 
project it is, includes different steps. For example "writing a book" is a 
new project and belongs to the project_type "hobby project".
 
"making a plan" and "get feedback" are steps for a "hobby project".  So the 
project "writing a book" should contain this steps.

*My question:*
After creating a second project and saying it's also a "hobby project" the 
new project is connected to the same steps like my first project. And if I 
modify anything in a step, like mark "making a plan" as completed, it's 
also completed for any other project. You can imagine that this is not what 
I want to do.

How can I create several steps for a new project, based on which 
project_type it is?

I thought about creating a new table "project-with-steps" and insert the 
project_id and each project_steps for the project_type into it, but maybe 
there is a smarter solution? 

This is my current database definition:

db.define_table('project_type',
Field('title', notnull=True, unique=True),
Field('description', 'text', notnull=True),
format='%(title)s')

db.define_table('project',
Field('name', notnull=True),
Field('description', 'text', notnull=True),
Field('project_type', db.project_type, notnull=True),
format='%(name)s')

db.define_table('step',
Field('title',  notnull=True, unique=True),
Field('description', 'text', notnull=True),
Field('project_id', db.project),
format='%(title)s')


db.define_table('project_type_with_steps',
Field('type_id', db.project_type),
Field('step_id', db.step))




Thanks for your help!
Andreas

-- 

--- 
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/groups/opt_out.


[web2py] understanding problem - use models or classes?

2013-09-05 Thread Andreas Wienes
Hello,

I'm new to web2py and python and currently try to build a small application 
just for learning purposes. Now I struggle because I don't know if my 
solution is the right way doing it.

I got three models called project, project_type and steps.

A project belongs to a certain project_type and depending on what kind of 
project it is, includes different steps. For example "writing a book" is a 
project and belongs to the project_type "hobby project".
 
"making a plan", "do it" and "get feedback" are steps for a "hobby 
project".  So the project "writing a book" should contain this steps.

Is it correct to create three tables, one for each model, and work with 
database reference or is this completly wrong and instead I should work 
with classes?

Sorry for the silly question, but I'm just a noob trying to code something. 
;-)

This is my current database definition:

db.define_table('project_type',
Field('title', notnull=True, unique=True),
Field('description', 'text', notnull=True),
format='%(title)s')

db.define_table('project',
Field('name', notnull=True),
Field('description', 'text', notnull=True),
Field('project_type', db.project_type, notnull=True),
format='%(name)s')

db.define_table('step',
Field('title',  notnull=True, unique=True),
Field('description', 'text', notnull=True),
Field('project_id', db.project),
format='%(title)s')


db.define_table('project_type_with_steps',
Field('type_id', db.project_type),
Field('step_id', db.step))




All the best
Andreas

-- 

--- 
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/groups/opt_out.