text: from users.models import Profile
  from django.shortcuts import render, redirect
  from django.contrib import messages
  from django.http import JsonResponse
  from django.urls import reverse_lazy
  from django.contrib.messages.views import SuccessMessageMixin
  from django.contrib.auth.decorators import login_required
  from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
  from django.views.generic.edit import CreateView
  from django.views.generic import DetailView
  from .models import Profile
  
  
  class SignUpView(SuccessMessageMixin, CreateView):
      template_name = 'users/register.html'
      success_url = reverse_lazy('login')
      form_class = UserRegisterForm
      success_message = "Your profile was created successfully"
  
  
  @login_required
  def profile(request):
      if request.method == 'POST':
          u_form = UserUpdateForm(request.POST, instance=request.user)
          p_form = ProfileUpdateForm(
              request.POST, request.FILES, instance=request.user.profile)
          if u_form.is_valid() and p_form.is_valid():
              u_form.save()
              p_form.save()
              messages.success(request, f'Your account has been updated!')
              return redirect('users:profile')
      else:
          u_form = UserUpdateForm(instance=request.user)
          p_form = ProfileUpdateForm(instance=request.user.profile)
      context = {'u_form': u_form, 'p_form': p_form}
      return render(request, 'users/profile.html', context)
  
  
  class AccountDetailView(DetailView):
      model = Profile
      template_name = "users/profilepage.html"
  