Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

django-admin fixture generator command

License

NotificationsYou must be signed in to change notification settings

ilia4bit/mockango

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-admin fixtures(initial data) generator command

requirements

pip install djangopip install mimesispip install pyyamlpip 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

classPost(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:Tis_publish:falsepublished_date:2018-02-21 05:29:26.253161text:Messages can be sent to and received from ports, but these messages mustobey 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 andan escape convention exists which allows any character to be used within anatom. 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 mustobey the so-called "port protocol."model:posts.postpk:1-fields:category:Nis_publish:falsepublished_date:2009-01-25 08:37:08.793574text: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 beaccessed 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, thefirst character being lowercase.model:posts.postpk:2-fields:category:Tis_publish:falsepublished_date:2013-01-03 11:28:01.825650text:He looked inquisitively at his keyboard and wrote another sentence. Anyelement of a tuple can be accessed in constant time. Haskell is a standardized,general-purpose purely functional programming language, with non-strict semanticsand strong static typing. Atoms are used within a program to denote distinguishedvalues. Atoms can contain any character if they are enclosed within single quotesand an escape convention exists which allows any character to be used withinan atom.title:They are written as strings of consecutive alphanumeric characters, thefirst character being lowercase.model:posts.postpk:3-fields:category:Tis_publish:falsepublished_date:2006-06-24 11:19:25.527136text: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 receivedfrom ports, but these messages must obey the so-called "port protocol." Thesequential subset of Erlang supports eager evaluation, single assignment, anddynamic 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.postpk:4-fields:category:Tis_publish:truepublished_date:2006-10-17 12:10:48.115520text:Tuples are containers for a fixed number of Erlang data types. It is alsoa garbage-collected runtime system. He looked inquisitively at his keyboardand wrote another sentence. The Galactic Empire is nearing completion of theDeath Star, a space station with the power to destroy entire planets. Messagescan 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.postpk:5

If You Find It Useful

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

Thanks :)


[8]ページ先頭

©2009-2025 Movatter.jp