# 63 Refactoring
* refactors django User model to custom User model to provide further attributes and methods directly on the user model
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User
|
||||
from user.models import User
|
||||
from django.http import HttpRequest
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
@@ -8,7 +8,6 @@ from django.utils.translation import gettext_lazy as _
|
||||
from konova.contexts import BaseContext
|
||||
from konova.decorators import any_group_check
|
||||
from user.forms import UserNotificationForm, UserContactForm
|
||||
from user.models import KonovaUserExtension
|
||||
|
||||
|
||||
@login_required
|
||||
@@ -43,9 +42,6 @@ def notifications_view(request: HttpRequest):
|
||||
"""
|
||||
template = "user/notifications.html"
|
||||
user = request.user
|
||||
konova_ext = KonovaUserExtension.objects.get_or_create(
|
||||
user=user
|
||||
)[0]
|
||||
|
||||
form = UserNotificationForm(user=user, data=request.POST or None)
|
||||
if request.method == "POST":
|
||||
@@ -65,7 +61,6 @@ def notifications_view(request: HttpRequest):
|
||||
context = {
|
||||
"user": user,
|
||||
"form": form,
|
||||
"konova_ext": konova_ext,
|
||||
}
|
||||
context = BaseContext(request, context).context
|
||||
return render(request, template, context)
|
||||
|
||||
Reference in New Issue
Block a user