﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23422	Cannot add Permission to Group in data migration	Tomas Walch	nobody	"As initial_data fixtures are now deprecated I want to move my things there to migration files instead. One thing I do is to create auth.Group(s) and give these some custom permissions that I have defined on the app's models. This does not seem to be possible as, from what I can tell, the permissions and content types are created in a signal AFTER all the Migrations are run. Neither custom nor standard permissions can be found.

A Group and its permissions are data and the initialization thereof should therefore be possible to achieve through the migration system since its supposed to replace the fixtures.

{{{
my_new_group.permissions.add(
    Permission.objects.get_by_natural_key('add_my_model', 'my_app', 'my_model')
)
}}}

This gives:

{{{
django.contrib.contenttypes.models.DoesNotExist: ContentType matching query does not exist.
}}}

even though I created the model in the previous migration step. There are no ContentTypes ate all yet.
"	Bug	closed	Migrations	1.7	Normal	wontfix		bronger@… scott.woodall@… hv@… TZanke frnhr Alex Dehnert alan.justino@… django@… info@…	Unreviewed	0	1	0	0	0	0
