Wow. Thank you all so much, esp. sensei Oleg!
Eiji
On Sun, May 8, 2011 at 10:11 AM, Oleg Lomaka wrote:
> To extend Shawn's answer on your example :)
>
> params = {'username': 'admin', 'email': 'x...@xyz.com', 'password':
> 'xyz123'}
> # then
> new_user = User(**params)
>
To extend Shawn's answer on your example :)
params = {'username': 'admin', 'email': 'x...@xyz.com', 'password': 'xyz123'}
# then
new_user = User(**params)
new_user.save()
# or
User.objects.create(**params)
On Sun, May 8, 2011 at 1:44 PM, Eiji Kobayashi wrote:
> Hi!
>
>
You can do it with a dictionary. Just pass it using **kwargs.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
Hi!
Sorry. Another question, please.
Is it possible to create a model instance using a string parameter?
Example, I would like to be able to do something like:
param = "username='admin', email='x...@xyz.com', password='xyz123'"
new_user = User(param)
Of course this won't work. But is there a
4 matches
Mail list logo