klen / klen/mixer

Skip Django related models generation when primary key is provided

Open
#28 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
953
Forks
91
PR merge metrics
No merged PRs in 30d

Description

It would be nice to skip generation of related Django model when related key is provided. Example:

```
class Author(models.Model):
...

class Book(models.Model):
author = models.ForeignKey(Author)
...
# don't generate extra author instance
mixer.blend(Book, author_id=3)
```
##

---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/6290149-skip-django-related-models-generation-when-primary-key-is-provided?utm_campaign=plugin&utm_content=tracker%2F327725&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F327725&utm_medium=issues&utm_source=github).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the Django model-generation path and reproduce the example with Book and author_id=3. The work is done when supplying the related model's primary-key field prevents Mixer from generating an extra related Author instance.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.