django-admin fixture generator command

Overview

Mockango

for short mockango is django fixture generator command which help you have data without pain for test development

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

give it one star, make issue if you find something missing, share with your friends

Thanks :)

You might also like...
django's default admin interface made customizable. popup windows replaced by modals. :mage: :zap:
django's default admin interface made customizable. popup windows replaced by modals. :mage: :zap:

django-admin-interface django-admin-interface is a modern responsive flat admin interface customizable by the admin itself. Features Beautiful default

Extendable, adaptable rewrite of django.contrib.admin
Extendable, adaptable rewrite of django.contrib.admin

django-admin2 One of the most useful parts of django.contrib.admin is the ability to configure various views that touch and alter data. django-admin2

Modern theme for Django admin interface
Modern theme for Django admin interface

Django Suit Modern theme for Django admin interface. Django Suit is alternative theme/skin/extension for Django administration interface. Project home

Django application and library for importing and exporting data with admin integration.
Django application and library for importing and exporting data with admin integration.

django-import-export django-import-export is a Django application and library for importing and exporting data with included admin integration. Featur

:honey_pot: A fake Django admin login screen page.

django-admin-honeypot django-admin-honeypot is a fake Django admin login screen to log and notify admins of attempted unauthorized access. This app wa

"Log in as user" for the Django admin.

django-loginas About "Login as user" for the Django admin. loginas supports Python 3 only, as of version 0.4. If you're on 2, use 0.3.6. Installing dj

Visually distinguish environments in Django Admin
Visually distinguish environments in Django Admin

django-admin-env-notice Visually distinguish environments in Django Admin. Based on great advice from post: 5 ways to make Django Admin safer by hakib

A new style for Django admin
A new style for Django admin

Djamin Djamin a new and clean styles for Django admin based in Google projects styles. Quick start Install djamin: pip install -e git://github.com/her

Responsive Theme for Django Admin With Sidebar Menu
Responsive Theme for Django Admin With Sidebar Menu

Responsive Django Admin If you're looking for a version compatible with Django 1.8 just install 0.3.7.1. Features Responsive Sidebar Menu Easy install

aiohttp admin is generator for admin interface based on aiohttp

aiohttp admin is generator for admin interface based on aiohttp

Mykhailo Havelia 17 Nov 16, 2022
Jet Bridge (Universal) for Jet Admin – API-based Admin Panel Framework for your application

Jet Bridge for Jet Admin – Admin panel framework for your application Description About Jet Admin: https://about.jetadmin.io Live Demo: https://app.je

Jet Admin 1.3k Dec 27, 2022
📱 An extension for Django admin that makes interface mobile-friendly. Merged into Django 2.0

Django Flat Responsive django-flat-responsive is included as part of Django from version 2.0! ?? Use this app if your project is powered by an older D

elky 248 Sep 2, 2022
An improved django-admin-tools dashboard for Django projects

django-fluent-dashboard The fluent_dashboard module offers a custom admin dashboard, built on top of django-admin-tools (docs). The django-admin-tools

django-fluent 326 Nov 9, 2022
A Django app for easily adding object tools in the Django admin

Django Object Actions If you've ever tried making admin object tools you may have thought, "why can't this be as easy as making Django Admin Actions?"

Chris Chang 524 Dec 26, 2022
Disable dark mode in Django admin user interface in Django 3.2.x.

Django Non Dark Admin Disable or enable dark mode user interface in Django admin panel (Django==3.2). Installation For install this app run in termina

Artem Galichkin 6 Nov 23, 2022
Modern responsive template for the Django admin interface with improved functionality. We are proud to announce completely new Jet. Please check out Live Demo

Django JET Modern template for Django admin interface with improved functionality Attention! NEW JET We are proud to announce completely new Jet. Plea

Geex Arts 3.4k Dec 29, 2022
Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.

Xadmin Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap. Liv

差沙 4.7k Dec 31, 2022
A jazzy skin for the Django Admin-Interface (official repository).

Django Grappelli A jazzy skin for the Django admin interface. Grappelli is a grid-based alternative/extension to the Django administration interface.

Patrick Kranzlmueller 3.4k Dec 31, 2022
A Django admin theme using Twitter Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed apps.

django-admin-bootstrapped A Django admin theme using Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed ap

null 1.6k Dec 28, 2022