question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Common recipe for reverse dependencies doesn't work

See original GitHub issue

The common recipe for a RelatedFactory (on http://factoryboy.readthedocs.org/en/latest/recipes.html) shows as this:

# models.py
class User(models.Model):
    pass

class UserLog(models.Model):
    user = models.ForeignKey(User)
    action = models.CharField()


# factories.py
class UserFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = models.User

    log = factory.RelatedFactory(UserLogFactory, 'user', action=models.UserLog.ACTION_CREATE)

At least with Django 1.8.2 these actions are nowhere to be found, raising an attribute error.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rbarroiscommented, Aug 7, 2017

@pavan-blackbuck If I understand correctly, the issue was that the example code expected the user to have defined some ACTION_CREATE on the custom UserLog model; obviously, this would fail if you don’t define such fields on your own models.

0reactions
pavan-blackbuckcommented, Aug 7, 2017

@rbarrois Thank you. Got this resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

rez-cook: a rez package manager · Discussion #1347 - GitHub
Given a package request to cook, it will find a matching recipe, and the recipes for its entire dependency tree, figure out which...
Read more >
Why reverse dependencies does not work with rpm command?
While checking the package dependencies for one package, it works well as below :- Raw. This is just an example # rpm -qR...
Read more >
Package reverse dependency checks (especially on Windows)
I would like to hear how folks do their reverse dependency checks on ... on CRAN yet and which does not build in...
Read more >
Is the crate dependency becoming a problem? : r/rust - Reddit
Hey there,. I am new to Rust and having a blast. I really enjoy the language. However, I noticed that dependencies are really...
Read more >
Common recipes — Factory Boy stable documentation
Reverse dependencies (reverse ForeignKey) . When a related object should be created upon object creation (e.g a reverse ForeignKey from another Model...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found