Re: Problem when getting the ID of the record just created

2014-10-13 Thread Daniel Grace
Thanks for the help. I got the ID working and I used the "self.user.request". -- 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 django-users+unsubscr...@googlegr

Re: Problem when getting the ID of the record just created

2014-10-13 Thread Giuseppe Saviano
> User.objects.get(pk=self.request.user.id) because request.user is your > user object. > it's self.request.user - sorry. But the sense is the same: you don't need User.objects.get -- $ gpg --recv-key da5098a7 -- You received this message because you are subscribed to the Google Groups "Djang

Re: Problem when getting the ID of the record just created

2014-10-13 Thread Giuseppe Saviano
On Mon, Oct 13, 2014 at 3:13 PM, Daniel Grace wrote: > Hi, > I have problem when getting the ID of the record just created. > > class CreateFlow(CreateView): > model = Flow > fields = ['state'] > template_name = 'create_flow.html' >

Re: Problem when getting the ID of the record just created

2014-10-13 Thread Joseph Mutumi
Should get the flow instance from the form.save() so: user = User.objects.get(pk=self.request.user.id) flow = form.save() log = Log(user=user, flow=flow, state=1) On Mon, Oct 13, 2014 at 4:13 PM, Daniel Grace wrote: > Hi, > I have problem when getting the ID of the record just c

Problem when getting the ID of the record just created

2014-10-13 Thread Daniel Grace
Hi, I have problem when getting the ID of the record just created. class CreateFlow(CreateView): model = Flow fields = ['state'] template_name = 'create_flow.html' def form_valid(self, form): user = User.objects.get(pk=self.request.user.id) flow = Flow.objects.get(pk=self.kwa