I have not trimmed traceback. This is ouput came on python manage.py shell.

And one more thing I modified save method This looks like this:

   def save(self):
        if not self.id:
            self.created_date_time = datetimeToUTC()
            self.modified_date_time = datetimeToUTC()
        self.modified_date_time = datetimeToUTC()
        super(ModelName, self).save()
        if not self.uid:
            self.uid = idmaptoalpha.getUID(self.id)
            super(ModelName, self).save()

 Can you plz tell me if anything is wrong in it.

Thanks again.

*N.B.:*But I have not  modified method for Django's Group  Table. This is
only for the new Classed I created.

Regards,
Laxmikant


On Thu, Feb 7, 2013 at 11:49 PM, Tom Evans <tevans...@googlemail.com> wrote:

> 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.
>
>
>

-- 
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.


Reply via email to