Skip to content

Commit

Permalink
Support custom User model in external_add (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
davestgermain authored and shacker committed May 12, 2019
1 parent befc7ad commit caed3b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions todo/views/external_add.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.core.mail import send_mail
from django.http import HttpResponse
Expand Down Expand Up @@ -44,7 +44,7 @@ def external_add(request) -> HttpResponse:
task.task_list = TaskList.objects.get(slug=settings.TODO_DEFAULT_LIST_SLUG)
task.created_by = request.user
if defaults("TODO_DEFAULT_ASSIGNEE"):
task.assigned_to = User.objects.get(username=settings.TODO_DEFAULT_ASSIGNEE)
task.assigned_to = get_user_model().objects.get(username=settings.TODO_DEFAULT_ASSIGNEE)
task.save()

# Send email to assignee if we have one
Expand Down

0 comments on commit caed3b3

Please sign in to comment.