Created
December 1, 2011 06:12
-
-
Save h3/1414209 to your computer and use it in GitHub Desktop.
Template fixtures concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load fixture_tags %} | |
[ | |
{% genfixtures "1:5" %} | |
{ | |
"pk": {{ fixture.pk }}, | |
"model": "auth.user", | |
"fields": { | |
"username": "{% gen_char "my_custom_username_generator" %}", | |
"first_name": "{% gen_char "first_name" %}", | |
"last_name": "{% gen_char "last_name" %}", | |
"is_active": {% gen_boolean %}, | |
"is_superuser": false, | |
"is_staff": {% gen_boolean %}, | |
"last_login": "{% gen_datetime between "2010-01-01 00:00:00" and "00:00:00" %}", | |
"groups": [{% gen_m2m auth.group null %}, | |
"user_permissions": [], | |
"password": "{% gen_password %}", | |
"email": "{% gen_email %}", | |
"date_joined": "{% gen_datetime before today %}" | |
} | |
}{% if not fixture.last %},{% endif %} | |
{% endgenfixtures %} | |
{ | |
"pk": 6, | |
"model": "auth.user", | |
"fields": { | |
"username": "bofh", | |
"first_name": "", | |
"last_name": "", | |
"is_active": true, | |
"is_superuser": true, | |
"is_staff": true, | |
"groups": [], | |
"user_permissions": [], | |
"password": "sha1$a2c9e50d9da202c310d30d5152f5a525192a8908", | |
"email": "[email protected]", | |
"date_joined": "{% gen_datetime before today %}" | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment