From d88fcb03e2e520da6a7d0203d660e4536108f56b Mon Sep 17 00:00:00 2001 From: Jessica Tallon Date: Fri, 17 Jul 2015 17:51:51 +0200 Subject: Change codebase to query or create correct User model The code base had many references to User.username and other specific to LocalUser attributes as that was the way it use to exist. This updates those to query on the generic User model but filtering by attributes on the LocalUser. --- mediagoblin/edit/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mediagoblin/edit/views.py') diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index 8cee1cc0..224b93de 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -47,7 +47,7 @@ from mediagoblin.tools.text import ( convert_to_tag_list_of_dicts, media_tags_as_string) from mediagoblin.tools.url import slugify from mediagoblin.db.util import check_media_slug_used, check_collection_slug_used -from mediagoblin.db.models import User, Client, AccessToken, Location +from mediagoblin.db.models import User, LocalUser, Client, AccessToken, Location import mimetypes @@ -444,8 +444,9 @@ def change_email(request): if request.method == 'POST' and form.validate(): new_email = form.new_email.data - users_with_email = User.query.filter_by( - email=new_email).count() + users_with_email = User.query.filter( + LocalUser.email==new_email + ).count() if users_with_email: form.new_email.errors.append( -- cgit v1.2.3