~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to wlprofile/views.py

  • Committer: franku
  • Date: 2018-05-30 16:59:16 UTC
  • Revision ID: somal@arcor.de-20180530165916-4pntaexvqwczc31h
serve a HTTP404 if user matching query does not exist

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
from django.contrib.auth.models import User
7
7
from django.shortcuts import render
8
8
from django.http import HttpResponseRedirect
 
9
from django.shortcuts import get_object_or_404
9
10
 
10
11
from forms import EditProfileForm
11
12
import settings
24
25
    if user is None:
25
26
        profile = request.user.wlprofile
26
27
    else:
27
 
        profile = User.objects.get(username=user).wlprofile
 
28
        profile = get_object_or_404(User, username=user).wlprofile
28
29
 
29
30
    template_params = {
30
31
        'profile': profile,