Skip to main content

mockango

django-admin commands which generate fixture data for your given apps's models using Mimesis data generator

requirements

pip install django
pip install mimesis
pip install pyyaml
pip install colorama

installation

pip intall mockango
INSTALLED_APPS = [
  ...
  'mockango',
]

usage

app_labels(positional): labels of app you need fixture data for them

--num(optional)(default=10): number of object generate for each model

--foramt(optional)(default=yaml): format of fixture file

--locale(optional)(default=en): supported mimesis locales

python manage.py generatedata posts --num 5 --format yaml --locale fa

examples

models.py

class Post(models.Model):
  title = models.Charfield(max_length=200)
  text = models.TextField()
  is_publish = models.BooleanField(default=False)
  published_date = models.DateTimeField()
  CATEGORIES = [
    ('T', 'Tutorail'),
    ('N', 'Normal'),
    ]
  category = models.CharField(max_length=1, choices=CATEGORIES)

settings.py

INSTALLED_APPS = [
  ...
  'mockango',
  'posts',
]
python manage.py generatedata posts --num 5

posts/fixture/post/fixture_file.yaml

- fields:
    category: T
    is_publish: false
    published_date: 2018-02-21 05:29:26.253161
    text: Messages can be sent to and received from ports, but these messages must
      obey the so-called "port protocol." It is also a garbage-collected runtime system.
      Atoms can contain any character if they are enclosed within single quotes and
      an escape convention exists which allows any character to be used within an
      atom. The syntax {D1,D2,...,Dn} denotes a tuple whose arguments are D1, D2,
      ... Dn. Do you come here often?
    title: Messages can be sent to and received from ports, but these messages must
      obey the so-called "port protocol."
  model: posts.post
  pk: 1
- fields:
    category: N
    is_publish: false
    published_date: 2009-01-25 08:37:08.793574
    text: She spent her earliest years reading classic literature, and writing poetry.
      Do you have any idea why this is not working? Any element of a tuple can be
      accessed in constant time. Its main implementation is the Glasgow Haskell Compiler.
      Tuples are containers for a fixed number of Erlang data types.
    title: They are written as strings of consecutive alphanumeric characters, the
      first character being lowercase.
  model: posts.post
  pk: 2
- fields:
    category: T
    is_publish: false
    published_date: 2013-01-03 11:28:01.825650
    text: He looked inquisitively at his keyboard and wrote another sentence. Any
      element of a tuple can be accessed in constant time. Haskell is a standardized,
      general-purpose purely functional programming language, with non-strict semantics
      and strong static typing. Atoms are used within a program to denote distinguished
      values. Atoms can contain any character if they are enclosed within single quotes
      and an escape convention exists which allows any character to be used within
      an atom.
    title: They are written as strings of consecutive alphanumeric characters, the
      first character being lowercase.
  model: posts.post
  pk: 3
- fields:
    category: T
    is_publish: false
    published_date: 2006-06-24 11:19:25.527136
    text: Haskell features a type system with type inference and lazy evaluation.
      It is also a garbage-collected runtime system. Messages can be sent to and received
      from ports, but these messages must obey the so-called "port protocol." The
      sequential subset of Erlang supports eager evaluation, single assignment, and
      dynamic typing. Tuples are containers for a fixed number of Erlang data types.
    title: The syntax {D1,D2,...,Dn} denotes a tuple whose arguments are D1, D2, ...
      Dn.
  model: posts.post
  pk: 4
- fields:
    category: T
    is_publish: true
    published_date: 2006-10-17 12:10:48.115520
    text: Tuples are containers for a fixed number of Erlang data types. It is also
      a garbage-collected runtime system. He looked inquisitively at his keyboard
      and wrote another sentence. The Galactic Empire is nearing completion of the
      Death Star, a space station with the power to destroy entire planets. Messages
      can be sent to and received from ports, but these messages must obey the so-called
      "port protocol."
    title: Ports are created with the built-in function open_port.
  model: posts.post
  pk: 5

If You Find It Useful

Hi my friend if you find mockango useful please give it one star or share with your friends. I think it can be imporve it so if you find something missing make issue Thanks

Metadata

Release files for mockango 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mockango 1.0.1
File Size Uploaded Provenance Actions
mockango-1.0.1.tar.gz 9.7 kB Without provenance Details for mockango-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mockango 1.0.1
File Interpreter ABI Platform Actions
mockango-1.0.1-py3-none-any.whl Python 3 none any Details for mockango-1.0.1-py3-none-any.whl

Total release size: 19.4 kB

Release files / mockango-1.0.1.tar.gz

Download URL mockango-1.0.1.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ccf5a3644ffd65d00e00ae4f951da3da8e52b0aaf9f3df4a3459113621af8acf
BLAKE2b-256 checksum
How to use checksums
80327953bf5ff59e26b09f7c30cc7c8165198b7f77fbbaf17393672060bdde60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.7 Linux/5.14.2-zen1-2-zen

Release files / mockango-1.0.1-py3-none-any.whl

Download URL mockango-1.0.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b311613aa6bc290d8ba01941d46f31c8c828d5c47a9aa09d957bf75c885103a3
BLAKE2b-256 checksum
How to use checksums
d725dd8f7a2cf221f65bfdd22429f995b5a3f8c04050b1df3e594b77a2377cea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.7 Linux/5.14.2-zen1-2-zen

Security for mockango 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page