It should be 

http://.../post_message/1

to post a message for user #1.


On Monday, 5 August 2013 03:29:53 UTC-5, Alex Glaros wrote:
>
> Massimo,
>
> I receive a 404 NOT FOUND error from the post_message function. 
>
> The messages_for_me controller works, but there's no way to reply.
>
> I changed the code a little.  "message" is a NoSQL reserved word, and I 
> assumed that you meant "reference auth_user" on the "for_user" field in the 
> DB.
>
> any ideas on how to solve the 404 NOT FOUND error?
>
> thanks,
>
> Alex
>
> db.define_table('messages',  
>     Field('for_user','reference auth_user'),
>     Field('body'),
>     auth.signature)
>
> @auth.requires_login()
> def post_message():
>     user_id = request.args(0,cast=int)
>     db.messages.for_user.default = user_id
>     db.messages.for_user.readable = db.messages.for_user.writable=False
>     form = SQLFORM(db.messages).process()
>     return locals()
>
> @auth.requires_login()
> def messages_for_me():
>      grid = SQLFORM.grid(db.messages.for_user==auth.user.id
> ,editable=False,create=False)
>      return locals()
>
>
>
> On Monday, August 5, 2013 12:48:34 AM UTC-7, Massimo Di Pierro wrote:
>>
>> Here is something very basic:
>>
>> db.define_table('message',
>>     Field('for_user','reference_user'),
>>     Field('body'),
>>     auth.signature)
>>
>> @auth.requires_login()
>> def post_message():
>>     user_id = request.args(0,cast=int)
>>     db.message.for_user.default = user_id
>>     db.message.for_user.readable = db.message.for_user.writable=False
>>     form = SQLFORM(db.message).process()
>>     return locals()
>>
>> @auth.requires_login()
>> def messages_for_me():
>>      grid = SQLFORM.grid(db.message.for_user==auth.user.id
>> ,editable=False,create=False)
>>      return locals()
>>
>>
>> On Sunday, 4 August 2013 20:29:47 UTC-5, Alex Glaros wrote:
>>>
>>> Can anyone help me think of a primitive form of internal messaging 
>>> between users of an app?  No external email, nothing fancy because I have 
>>> limited programming skill.
>>>
>>> The only requirement is that a user can leave a message for another 
>>> user, and the other user can reply.
>>>
>>> Example: 
>>>
>>>
>>>    1. User-A leaves a message for User-B, "Hi, can you please give me 
>>>    your external email address?"  
>>>    2. User-B says: "Sure, here it is, [email protected]"
>>>    
>>>
>>> So I suppose there might be a db.Internal_Mail table.
>>>
>>>
>>>    - auth_user_message_sender
>>>    - auth_user_message_recipient
>>>    - subject_of_message
>>>    - body_of_message
>>>    - date_time_sent
>>>    - has_this_message_been_read_yet?
>>>    
>>>
>>>
>>>    1. set up permissions so that users can read all records in 
>>>    db.Internal_Mail table that have their name either in the 
>>>    auth_user_messsage_sender or  auth_user_message_recipient fields
>>>    2. set up permissions so that users can edit/delete all records in 
>>>    db.Internal_Mail table that have their name in the auth_user_sender field
>>>    
>>>
>>> Based on above, seems that smartgrid or grid could handle all of the 
>>> requirements except knowing how to reply and to who, which seems 
>>> complicated to program. To reply, perhaps would have a controller named 
>>> reply_to_an_email.  It would let user 
>>>
>>>    1. search through the emails
>>>    2. somehow select only one
>>>    3. then create a record in db.Internal_Mail table that switches 
>>>    contents of sender and recipient fields of selected record, copies 
>>> subject 
>>>    line from the received message, and lets recipient fill out the body of 
>>> the 
>>>    reply message.
>>>    
>>>
>>> Any ideas? Is this already written elsewhere?  If not, would this be 
>>> useful to anyone else?
>>>
>>> Thanks,
>>>
>>> Alex Glaros
>>>
>>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to