I've found out that this error is happening because I also have a def 
save() function on the committee model.
So I am not sure if this is a bug or I am not suppose to have it like that.

On Tuesday, October 20, 2015 at 9:02:27 PM UTC+3, Yaniv Mirel wrote:
>
> Hi,
>
> I am getting this error when running model post save signal.
> The error traceback is for gr.save()
>
> it seems like the committee model is not saving before it need to be assigned 
> to GroupRole model as a FK.
>
> this is the post_save signal code.
>
>
>
> @receiver(post_save, sender=Community)
> def set_default_reasons(sender, instance, created, 
> dispatch_uid='set_default_reasons', **kwargs):
>
> if created:
>
> committee = Committee(community=instance, name='Board', slug='main')
>
> committee.save()
>
>
> for group_role in settings.DEFAULT_GROUP_ROLES:
>
> gr = GroupRole(committee=committee, 
> role=instance.roles.get(title=group_role), 
> group=instance.groups.get(title=group_role)) 
>
> gr.save() 
>
>  
>
>  Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8f2927d2-27f3-4be9-8d51-f171320ed361%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to