On Thu, Feb 7, 2013 at 12:16 PM, laxglx <laxgl...@gmail.com> wrote: > > Hello Everybody, > > I'm going to create a Group using Django Group. > > I have two databases one is "master" and another is "slave" > In master I created a user and group as usual. > > And in slave database I tried like this: > > >>>> Group.objects.db_manager('slave').create(name="grp1") > > This returned an error : > > Traceback (most recent call last): > File "<console>", line 1, in <module> > File "/usr/lib/python2.6/site-packages/django/db/models/manager.py", line > 138, in create > return self.get_query_set().create(**kwargs) > File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line > 358, in create > obj.save(force_insert=True, using=self.db) > TypeError: save() got an unexpected keyword argument 'force_insert'
Have you trimmed this traceback? > > I also tried as follows, but got error : > >>>> g = Group() >>>> g.name = "grp1" >>>> g.save(using='slave') > Traceback (most recent call last): > File "<console>", line 1, in <module> > TypeError: save() got an unexpected keyword argument 'using' > It looks like you have overwritten the save() method on the model you are trying to save, and have not given it a method signature capable of accepting the necessary arguments that save() is expected to handle. I say 'looks like', since I think you have obliterated the parts of the traceback that would tell me… save() takes many arguments. If you are not specifying any additional arguments for your save() method, then it should look like so: def save(self, *args, **kwargs): This protects you from having to change the method if more arguments are added in later versions of django, eg when the 'using' argument was added in 1.2. As usual, the docs have canonical instructions on how to override model methods like save(): https://docs.djangoproject.com/en/1.4/topics/db/models/#overriding-model-methods Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.