Beispiel #1
0
def edituser(request, user_id):
	user = get_object_or_404(User,pk=user_id)
	if request.POST:
		form = UserForm(request.POST, instance=user)
		if form.is_valid():
			p = form.save(commit=False)
			p.save()
			return HttpResponseRedirect(reverse('misiproba:index'))
	else:
		form = UserForm(instance=user)	
		return render(request,'misiproba/edituser.html',{'form': form},)
Beispiel #2
0
def newuser(request):
	"""Add new user"""
	#return render(request,'misiproba/newuser.html')	#vegul a view adja vissza magat a html-t	
	if request.method == 'POST':
		form = UserForm(request.POST)
		
		if form.is_valid():
			p = form.save(commit=False)
			p.save()
			return HttpResponseRedirect(reverse('misiproba:index'))
	else:
		form = UserForm()
	return render(request,'misiproba/newuser.html',{'form': form},)
Beispiel #3
0
def edituser(request, user_id):
    user = get_object_or_404(User, pk=user_id)
    if request.POST:
        form = UserForm(request.POST, instance=user)
        if form.is_valid():
            p = form.save(commit=False)
            p.save()
            return HttpResponseRedirect(reverse('misiproba:index'))
    else:
        form = UserForm(instance=user)
        return render(
            request,
            'misiproba/edituser.html',
            {'form': form},
        )
Beispiel #4
0
def newuser(request):
    """Add new user"""
    #return render(request,'misiproba/newuser.html')	#vegul a view adja vissza magat a html-t
    if request.method == 'POST':
        form = UserForm(request.POST)

        if form.is_valid():
            p = form.save(commit=False)
            p.save()
            return HttpResponseRedirect(reverse('misiproba:index'))
    else:
        form = UserForm()
    return render(
        request,
        'misiproba/newuser.html',
        {'form': form},
    )