[Answered ]-Reverse for 'update' with keyword arguments '{'id': ''}' not found. 1 pattern(s) tried: ['update/(?P<id>[0-9]+)/\\Z']

1๐Ÿ‘

I was referencing Member model instead of ActiveMember hopefully this will help someone.

def update(request, id):
    member = ActiveMember.objects.get(pk=id)

    if request.method == 'POST':
        form = ActiveMemberForm(request.POST, instance=member)
        if form.is_valid():
            # update the existing `Band` in the database
            form.save()
            # redirect to the detail page of the `Band` we just updated
            return render(request, 'members/update.html', {
                'form': form,
                'success': True,
            })
    else:
        form = ActiveMemberForm(instance=member)

    return render(request, 'members/update.html', {
        'form': form, 
        'member': member,
        })
๐Ÿ‘คwormy505

Leave a comment