# Path: dwitter/user/forms.py
# class UserSettingsForm(ModelForm):
#     class Meta:
#         model = get_user_model()
#         fields = ('email',)


from django.contrib import messages
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render, redirect
from dwitter.user.forms import UserSettingsForm


def user_settings(request, url_username):
    user = get_object_or_404(User, username=url_username)
    if request.user != user:
        return HttpResponse(status=403)

    if request.method == 'POST':

# Path: dwitter/user/forms.py
# class UserSettingsForm(ModelForm):
#     class Meta:
#         model = get_user_model()
#         fields = ('email',)


# Path: dwitter/user/views.py
from django.contrib import messages
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render, redirect
from dwitter.user.forms import UserSettingsForm



def user_settings(request, url_username):
    user = get_object_or_404(User, username=url_username)
    if request.user != user:
        return HttpResponse(status=403)

    if request.method == 'POST':

        user_settings_form = UserSettingsForm(request.POST, instance=user)