Jonknee, That cleared up major! Thanx for your teachings.
Regards, Gerard. jonknee wrote: >> I read that Django knows the difference between a new and a updated record, >> but it replicates the customer if I don't set the customer_id before a >> customer.save. Would somebody please shoot at my code and tell me where the >> room for improvement is hiding? > > You're almost there, just make sure to initiate your form with the > instance during POST requests. So move this line to before the if/ > else: > > customer = get_object_or_404(Customer, pk=customer_id) > > And change form = CustomerForm(request.POST) to form = > CustomerForm(request.POST, instance=customer). That will let the model > know you're working with an existing record and will automatically > update the record instead of creating it. > > -- urls = { 'fun': 'www.zonderbroodje.nl', 'tech': 'www.gp-net.nl' } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---