Ok, thanks. I'll try it tomorrow.
What is the meaning of the **? Thanks, Thomas On 3 Nov., 17:53, Daniel Roseman <[email protected]> wrote: > On Nov 3, 4:17 pm, Thomas M <[email protected]> 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

