Closed marcoshemann closed 8 years ago
Can you please post your actual models here. The IntegrityError says that, you have user
field (either in parent/child model) which is required(*), and I think you excluded the same field from your form.
Yeah you are right, its not reaching post_inline_create_signal, check your parent model for required fields.
Yes its is required, is like this update_by = models.ForeignKey(User, related_name='updateby')
I observe that in CreateUpdateViewMixin you followed a sequence, Save(commit=false) signal.send instance.save() return
send signal before instance.save
and in InlineFormsetViewMixin you did dont the same sequence.
...save signal.send return
you put send signal AFTER save. This isnt a problem, ?? with this a receive a signal after save i could dont insert parent.updated_by = request.user, this is dont work.
This code may be lke this?
def form_valid(self, form): context = self.get_context_data() inlineformset = context['inlineformset']
if inlineformset.is_valid():
children = inlineformset.save(commit=False)
self.object = form.save(commit=False)
inlineformset.instance = self.object
signal = self.get_actual_signal
signal.send(
sender=self.model,
request=self.request,
parent=self.object,
children=children)
inlineformset.save()
self.object.save()
Excellent point noted. I'm on it.
Bug has been resolved here : https://github.com/asifpy/django-crudbuilder/commit/4e5a7c9b36bd95e3f6c6d5c27142901cf067604b
Hi,
I am try to user a def post_inline_create_handler(sender, **kwargs): to include like parent.updated_by = request.user
So whem I submit a create I take a error django.db.utils.IntegrityError: (1048, "Column 'user_id' cannot be null") I include a print ("tag") but i dont see this print.
I think that create inleine dosent call this signal. may you see this.? Regards,