List Info

Thread: manipulator.save() and manytomany relationship




manipulator.save() and manytomany relationship
user name
2006-03-30 08:11:33
On 3/30/06, yml <yann.maletgmail.com> wrote:
>
> Your suggestion give the same result:
>
temp.set_localisation(map(int,new_data['localisation']))
>
> Only the last selected localisation is saved.
>
>

I think you can print new_data['localisation'] to see if
it's what you want.

--
I like python!
My Blog: http://www.donews.net/l
imodou
My Site: http://www.djangocn.org
NewEdit Maillist: http://groups.
google.com/group/NewEdit

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

manipulator.save() and manytomany relationship
user name
2006-03-30 09:44:54
This is an amazing tip. I didn't know that I could print
messages in
the runserver console.
I was missing that a lot. this is eaxcltly were the problem
is for some
unknown reason the information is correct in new_data but
when I am
retrieving new_data['localisation'] I got only the last
piece of the
list.
In the example below new_data['localisation'] transform
['1','2'] en 2


==========
trace in the runserver console
=============

Starting server on port 8000 with settings module
'votreservice.settings'.
Go to http://127.0.0.1:8000/ for
Django.
Quit the server with CONTROL-C (Unix) or CTRL-BREAK
(Windows).
new_data contains : <MultiValueDict:
{'memberShipLevel': ['1'],
'gender': ['1'], 'pseudo': ['test_print'],
'localisation': ['1',
2'], 'phonenumber': [''], 'address': [''],
'want_to_publised_personal_info': [False]}>
new_data['localisation'] contains : 2
[30/Mar/2006 11:34:53] "POST /profiles/create_manip/
HTTP/1.1" 302 0
[30/Mar/2006 11:34:53] "GET /profiles/ HTTP/1.1"
200 2896
Validating models...
0 errors found.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

manipulator.save() and manytomany relationship
user name
2006-03-30 09:52:13
On 3/30/06, yml <yann.maletgmail.com> wrote:
>
> This is an amazing tip. I didn't know that I could
print messages in
> the runserver console.
> I was missing that a lot. this is eaxcltly were the
problem is for some
> unknown reason the information is correct in new_data
but when I am
> retrieving new_data['localisation'] I got only the
last piece of the
> list.
> In the example below new_data['localisation']
transform ['1','2'] en 2
>
>
> ==========
> trace in the runserver console
> =============
>
> Starting server on port 8000 with settings module
> 'votreservice.settings'.
> Go to http://127.0.0.1:8000/ for
Django.
> Quit the server with CONTROL-C (Unix) or CTRL-BREAK
(Windows).
> new_data contains : <MultiValueDict:
{'memberShipLevel': ['1'],
> 'gender': ['1'], 'pseudo': ['test_print'],
'localisation': ['1',
> 2'], 'phonenumber': [''], 'address': [''],
> 'want_to_publised_personal_info': [False]}>
> new_data['localisation'] contains : 2
> [30/Mar/2006 11:34:53] "POST
/profiles/create_manip/ HTTP/1.1" 302 0
> [30/Mar/2006 11:34:53] "GET /profiles/
HTTP/1.1" 200 2896
> Validating models...
> 0 errors found.
>

So you should trace where the new_data['localisation'] be
changed.

--
I like python!
My Blog: http://www.donews.net/l
imodou
My Site: http://www.djangocn.org
NewEdit Maillist: http://groups.
google.com/group/NewEdit

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

manipulator.save() and manytomany relationship
user name
2006-03-30 10:02:56
Thank you you are amazing
============
here it the solution
=============
        if new_data['localisation']:
            print "new_data contains : "
+str(new_data)
            loc=new_data.getlist('localisation')
            print 'loc : '+str(loc)
            print "new_data['localisation'] contains
: " +str(loc)
            temp.set_localisation(loc)

the explanation is obvious when you know about it.
here it is the complete explanation:
http://www.djangoproject.com/docum
entation/request_response/#querydict-objects

The short one is :
  * new_data['localisation']  return the last value
  * new_data.getlist('localisation') return the list

this is the kind of thing where you have to get burned once
before
knowing it is hot for ever...

Thank you very much limodou for your great support.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

manipulator.save() and manytomany relationship
user name
2006-03-30 11:42:08
On 3/30/06, yml <yann.maletgmail.com> wrote:
>
> Thank you you are amazing
> ============
> here it the solution
> =============
>         if new_data['localisation']:
>             print "new_data contains : "
+str(new_data)
>             loc=new_data.getlist('localisation')
>             print 'loc : '+str(loc)
>             print "new_data['localisation']
contains : " +str(loc)
>             temp.set_localisation(loc)
>
> the explanation is obvious when you know about it.
> here it is the complete explanation:
> http://www.djangoproject.com/docum
entation/request_response/#querydict-objects
>
> The short one is :
>   * new_data['localisation']  return the last value
>   * new_data.getlist('localisation') return the list
>
> this is the kind of thing where you have to get burned
once before
> knowing it is hot for ever...
>
> Thank you very much limodou for your great support.
>

You are welcome. I forgot that if you want to get a list
from a
MultiDict you should using getlist(). But it seems no this
situation
in M-R branch. I'll check the source code carefully.

:P

--
I like python!
My Blog: http://www.donews.net/l
imodou
My Site: http://www.djangocn.org
NewEdit Maillist: http://groups.
google.com/group/NewEdit

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )