def update_avatar request name if request method POST form AvatarForm

1
2
3
4
5
def update_avatar(request, name):
if request.method == "POST":
form = AvatarForm(request.POST, request.FILES)
if form.is_valid():
UserProfile.objects.filter(user__username = name).update(avatar = ???)