From 82eb9de99335c0032986fb3273f9951756205fb9 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 4 Oct 2010 17:44:40 -0500 Subject: Make user profile a OneToOneField We had this set up as a unique ForeignKey before, which adds some indirection due to the RelatedManager object being there. By making it a OneToOneField, we can get the profile object directly, enforce uniqueness, and also use it in select_related() calls to make our profiles page a bit more efficient. Signed-off-by: Dan McGee --- packages/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/views.py b/packages/views.py index 4cc4cc2f..60867d19 100644 --- a/packages/views.py +++ b/packages/views.py @@ -43,7 +43,7 @@ def update(request): mode = 'disown' if mode: - repos = request.user.userprofile_user.all()[0].allowed_repos.all() + repos = request.user.userprofile.allowed_repos.all() pkgs = Package.objects.filter(id__in=ids, repo__in=repos) disallowed_pkgs = Package.objects.filter(id__in=ids).exclude( repo__in=repos) -- cgit v1.2.3-54-g00ecf