Also, ContentType.objects.get_for_model does not work ('Manager' object has 
no attribute 'get_for_model').


Le mercredi 15 octobre 2014 07:43:03 UTC-5, Michael a écrit :
>
> I do not want to  create a permission, I want to assign to a group some of 
> the default permissions django creates: add, change and delete (
> https://docs.djangoproject.com/en/dev/topics/auth/default/#default-permissions
> )
>
> Obviously, the permissions are not created yet when I run my first python 
> manage.py migrate since the following will raise a "Permission matching 
> query does not exist."
> Permission.objects.get(codename=codename)
> Permission.objects.get_by_natural_key('add_my_model', 'my_app', 
> 'my_model')
>
> Do you recommend to manually create the default permissions I am 
> interested about?
>
>
>
>
> Le mardi 14 octobre 2014 21:09:55 UTC-5, Andrew Godwin a écrit :
>>
>> As the ticket suggests, you can call the function to create permissions 
>> yourself in the data migration, and then you can assign them as normal. 
>> There's no need to use fixtures (in fact, migrations are better without 
>> fixtures, as there's no easy way to load them).
>>
>> Andrew
>>
>> On Tue, Oct 14, 2014 at 6:56 PM, Michael <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> Since the permissions are not yet created when the migrations are run, 
>>> it is not possible to have a data migration that creates a group and 
>>> assigns permissions.
>>>
>>> Based on this ticket: https://code.djangoproject.com/ticket/23422, I 
>>> understand there will not be a fix. Do you recommend to keep using an 
>>> initial fixture to create a group?
>>>
>>> Thanks
>>> Michael
>>>
>>>
>>>
>>>
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django developers (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/django-developers.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-developers/cce3b138-6524-417c-b05e-cd3c25742e3b%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-developers/cce3b138-6524-417c-b05e-cd3c25742e3b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e50dc3de-aec0-42df-803a-28da5c122085%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to