Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Improve documentation

### Removed

## [1.20.4](https://pypi.org/project/model-bakery/1.20.4/)
Expand Down
55 changes: 29 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,79 @@
[![Latest PyPI version](https://img.shields.io/pypi/v/model_bakery.svg)](https://pypi.python.org/pypi/model_bakery/)
[![Documentation Status](https://readthedocs.org/projects/model-bakery/badge/?version=latest)](https://model-bakery.readthedocs.io/en/latest/?badge=latest)

*Model Bakery* offers you a smart way to create fixtures for testing in
Django.
With a simple and powerful API you can create many objects with a single
line of code.
*Model Bakery* offers you a smart way to create fixtures for testing in Django. With a simple and powerful API, you can create many objects with a single line of code.

Model Bakery is a rename of the legacy [Model Mommy project](https://pypi.org/project/model_mommy/).
> **Note:** Model Bakery is a rename of the legacy [Model Mommy project](https://pypi.org/project/model_mommy/).

## Install
## Installation

```bash
pip install model-bakery
```

## Usage and Info

### Basic usage
## Basic usage

```python

# models.py

from django.db import models

class Customer(models.Model):
enjoy_jards_macale = models.BooleanField()
name = models.CharField(max_length=30)
email = models.EmailField()
age = models.IntegerField()
is_jards_macale_fan = models.BooleanField()
bio = models.TextField()
days_since_last_login = models.BigIntegerField()
birthday = models.DateField()
last_shopping = models.DateTimeField()

# test_models.py

from django.test import TestCase
from model_bakery import baker
from pprint import pprint

class TestCustomerModel(TestCase):
def setUp(self):
self.customer = baker.make('shop.Customer')
pprint(self.customer.__dict__)
print(self.customer.__dict__)

"""
{'_state': <django.db.models.base.ModelState object at 0x1129a3240>,
'age': 3841,
'bio': 'vUFzMUMyKzlnTyiCxfgODIhrnkjzgQwHtzIbtnVDKflqevczfnaOACkDNqvCHwvtWdLwoiKrCqfppAlogSLECtMmfleeveyqefkGyTGnpbkVQTtviQVDESpXascHAluGHYEotSypSiHvHzFteKIcUebrzUVigiOacfnGdvijEPrZdSCIIBjuXZMaWLrMXyrsUCdKPLRBRYklRdtZhgtxuASXdhNGhDsrnPHrYRClhrSJSVFojMkUHBvSZhoXoCrTfHsAjenCEHvcLeCecsXwXgWJcnJPSFdOmOpiHRnhSgRF',
'birthday': datetime.date(2019, 12, 3),
'enjoy_jards_macale': True,
'email': '[email protected]',
'is_jards_macale_fan': True,
'id': 1,
'last_shopping': datetime.datetime(2019, 12, 3, 21, 42, 34, 77019),
'name': 'qiayYnESvqcYLLBzxpFOcGBIfnQEPx',
'days_since_last_login': 6016}
'name': 'qiayYnESvqcYLLBzxpFOcGBIfnQEPx'}
"""

```

Check out [documentation](<http://model-bakery.readthedocs.org/>) for more complete examples.
## Documentation

For more detailed information, check out the [full documentation](https://model-bakery.readthedocs.io/).

## Contributing

Detailed info [here](https://github.com/model-bakers/model_bakery/blob/main/CONTRIBUTING.md).
As an open-source project, Model Bakery welcomes contributions of many forms:

- Code patches
- Documentation improvements
- Bug reports

Take a look at our [contribution guidelines](CONTRIBUTING.md) for instructions
on how to set up your local environment.

## Maintainers

- [Bernardo Fontes](https://github.com/berinhard/)
- [Rustem Saiargaliev](https://github.com/amureki/)
- [Tim Klein](https://github.com/timjklein36)
- [Bernardo Fontes](https://github.com/berinhard/)
- [Rustem Saiargaliev](https://github.com/amureki/)
- [Tim Klein](https://github.com/timjklein36)

## Creator

- [Vanderson Mota](https://github.com/vandersonmota/)
- [Vanderson Mota](https://github.com/vandersonmota/)

## License

Model Bakery is licensed under the MIT License.
See the [LICENSE](LICENSE) file for more information.
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ As an open-source project, Model Bakery welcomes contributions of many forms:
- Documentation improvements
- Bug reports

Take a look at our [GitHub repo](https://github.com/model-bakers/model_bakery/blob/main/CONTRIBUTING.md) for instructions on how to set up your local environment to help Model Bakery to grow.
Take a look at our [GitHub repo](https://github.com/model-bakers/model_bakery/blob/main/CONTRIBUTING.md) for instructions
on how to set up your local environment.

## Support

Expand Down