[Python-modules-team] Bug#745093: python-model-mommy: doesn't support models with post_save hooks
Mark Caglienzi
mark.caglienzi at gmail.com
Thu Apr 17 21:59:50 UTC 2014
Package: python-model-mommy
Version: 1.2-1
Severity: normal
Dear Maintainer,
I am using model_mommy with models like this:
class Operator(models.Model):
user = models.OneToOneField(User)
class OperatorContract(models.Model):
operator = models.ForeignKey(Operator, null=False, blank=False, related_name="contracts")
def create_user_profile(sender, instance, created, **kwargs):
if created:
Operator.objects.create(user=instance)
post_save.connect(create_user_profile, sender=User)
When I tell mommy
mommy.make('myapp.OperatorContract')
the test fails with this error:
IntegrityError: UNIQUE constraint failed: myapp_operator.user_id
I tried to clone from the main github repository [0] but the error was
reported as issue #113 [1]. I tried to clone [2] that claimed that the
error was fixed, but I experienced it also in that fork.
Then, finally, I found [3], cloned it, and it solved the issue (at least
for me).
If I understood correctly, it seems that the upstream developer didn't
want to merge the pull request done by tkrajca [4] (and maybe that's the
reason that made limdauto integrate the patch in his fork).
For now I'm using the 'right for me' fork [3], cloned and symlinked in my
project(s), but surely it isn't the best practice...
Kind regards,
Mark
[0] https://github.com/vandersonmota/model_mommy
[1] https://github.com/vandersonmota/model_mommy/issues/113
[2] https://github.com/tkrajca/model_mommy
[3] https://github.com/limdauto/model_mommy
[4] https://github.com/vandersonmota/model_mommy/pull/121
-- System Information:
Debian Release: jessie/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.13-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-model-mommy depends on:
ii python 2.7.5-5
ii python-django 1.5.4-1
ii python-mock 1.0.1-3
ii python-six 1.6.1-1
python-model-mommy recommends no packages.
python-model-mommy suggests no packages.
-- no debconf information
--
. ''`. | GPG Public Key : 0xCD542422 - Download it from http://is.gd/fOa7Vm
: :' : | GPG Fingerprint : 0823 A40D F31B 67A8 5621 AD32 E293 A2EB CD54 2422
`. `'` | Powered by Debian GNU/Linux, http://www.debian.org
`- | Try not. Do, or do not. There is no try. - Master Yoda, TESB.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20140417/e953d263/attachment.sig>
More information about the Python-modules-team
mailing list