aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/edit/views.py
diff options
context:
space:
mode:
authorJessica Tallon <tsyesika@tsyesika.se>2015-07-17 17:51:51 +0200
committerJessica Tallon <tsyesika@tsyesika.se>2015-07-31 15:15:24 +0200
commitd88fcb03e2e520da6a7d0203d660e4536108f56b (patch)
tree75b751fae15a037301bb384e64eba13746cb57a6 /mediagoblin/edit/views.py
parent283e6d8b9f09341e3b97418b79f389bfdfee6498 (diff)
downloadmediagoblin-d88fcb03e2e520da6a7d0203d660e4536108f56b.tar.lz
mediagoblin-d88fcb03e2e520da6a7d0203d660e4536108f56b.tar.xz
mediagoblin-d88fcb03e2e520da6a7d0203d660e4536108f56b.zip
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.
Diffstat (limited to 'mediagoblin/edit/views.py')
-rw-r--r--mediagoblin/edit/views.py7
1 files changed, 4 insertions, 3 deletions
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(