1👍
If you use Django >= 1.7 (with migrations) you could (and should) use Data Migrations.
https://docs.djangoproject.com/en/1.7/topics/migrations/#data-migrations
def create_group(apps, schema_editor):
Group = apps.get_model("auth", "Group")
g = Group.objects.create("Your group name")
UserGroup = apps.get_model("MyApp", "User_Group")
UserGroup.objects.create(user_id=2, group_id=g.id)
class Migration(migrations.Migration):
dependencies = [
('MyApp', '0001_initial'),
('auth','0001_initial'),
]
operations = [
migrations.RunPython(create_group),
]
Source:stackexchange.com