** is part of python the python grammar<http://docs.python.org/release/2.5.2/ref/grammar.txt>. See this<http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/>for more info on how to use * and ** in python
Brian On Wed, Nov 3, 2010 at 1:52 PM, Thomas M <tome2...@googlemail.com> wrote: > Ok, thanks. > > I'll try it tomorrow. > > What is the meaning of the **? > > Thanks, Thomas > > On 3 Nov., 17:53, Daniel Roseman <dan...@roseman.org.uk> wrote: > > On Nov 3, 4:17 pm, Thomas M <tome2...@googlemail.com> wrote: > > > > > Hi, > > > > > I have to save a model with dynamic fieldnames. So the field > > > identifiers are strings. > > > > > Example: > > > foo = Genre("genre_id"=2,"name"="ente") > > > foo.save() > > > > > This creates an error. Is it somehow possible to do this with the > > > model instance? > > > Or do I have to use custom SQL? > > > > > Thanks, Thomas > > > > This is invalid Python. You can't use strings as parameter names. > > > > What you can do is use a dictionary: > > > > values = {genre_id": 2, "name": "ente"} > > foo = Genre(**values) > > -- > > DR. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Brian Bouterse ITng Services -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.