Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Merge pull request #300 from bobsilverberg/remove_user_api
Browse files Browse the repository at this point in the history
Bug 1050417 - Remove One and Done User REST API
  • Loading branch information
bobsilverberg committed Oct 20, 2015
2 parents 56de420 + 4d6f34a commit 2888fa2
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 193 deletions.
2 changes: 1 addition & 1 deletion oneanddone/settings/base.py
Expand Up @@ -323,7 +323,7 @@ def JINJA_CONFIG():
LESS_BIN = config('LESSC_BIN', default='lessc')

# Testing configuration.
NOSE_ARGS = ['--logging-clear-handlers', '--logging-filter=-factory,-south']
NOSE_ARGS = ['--logging-clear-handlers', '--logging-filter=-factory,-south,-django.db']

# Should robots.txt deny everything or disallow a calculated list of URLs we
# don't want to be crawled? Default is false, disallow everything.
Expand Down
1 change: 1 addition & 0 deletions oneanddone/tasks/mixins.py
@@ -1,6 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.shortcuts import get_object_or_404
Expand Down
1 change: 1 addition & 0 deletions oneanddone/tasks/views.py
@@ -1,6 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from django.contrib import messages
from django.core.urlresolvers import reverse
from django.forms.models import model_to_dict
Expand Down
30 changes: 0 additions & 30 deletions oneanddone/users/serializers.py

This file was deleted.

135 changes: 0 additions & 135 deletions oneanddone/users/tests/test_api.py

This file was deleted.

7 changes: 2 additions & 5 deletions oneanddone/users/urls.py
Expand Up @@ -6,16 +6,13 @@
from oneanddone.users import views


urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^login/$', views.LoginView.as_view(), name='users.login'),
url(r'^profile/new/$', views.CreateProfileView.as_view(), name='users.profile.create'),
url(r'^profile/edit/$', views.UpdateProfileView.as_view(), name='users.profile.update'),
url(r'^profile/delete/$', views.DeleteProfileView.as_view(), name='users.profile.delete'),
url(r'^profile/$', views.MyProfileDetailsView.as_view(), name='users.profile.mydetails'),
url(r'^profile/(?P<id>\d+)/$', views.ProfileDetailsView.as_view(), name='users.profile.details'),
url(r'^profile/(?P<username>[^/\\]+)/$', views.ProfileDetailsView.as_view(), name='users.profile.details'),

# API URL's for interacting with User objects
url(r'^api/v1/user/$', views.UserListAPI.as_view(), name='api-user'),
url(r'^api/v1/user/(?P<email>[^/\\]+)/$', views.UserDetailAPI.as_view(), name='api-user-detail'),
)
24 changes: 2 additions & 22 deletions oneanddone/users/views.py
@@ -1,27 +1,25 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from django.contrib import messages
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import Http404
from django.shortcuts import redirect
from django.views import generic

from rest_framework import generics
from braces.views import LoginRequiredMixin
import django_browserid.views
from tower import ugettext as _
from random import randint
import re
from tower import ugettext as _

from oneanddone.base.urlresolvers import reverse_lazy
from oneanddone.tasks.models import TaskAttempt
from oneanddone.users.forms import UserProfileForm, SignUpForm
from oneanddone.users.mixins import UserProfileRequiredMixin
from oneanddone.users.models import UserProfile
from serializers import UserSerializer


def default_username(email, counter):
Expand Down Expand Up @@ -155,21 +153,3 @@ def login_failure(self, *args, **kwargs):
logging in, let us know by emailing <a href="mailto:{email}">{email}</a>.
""").format(email='oneanddone@mozilla.com'), extra_tags='safe')
return super(Verify, self).login_failure(*args, **kwargs)


class UserDetailAPI(generics.RetrieveDestroyAPIView):
"""
API endpoint used to get and delete user data.
"""
lookup_field = 'email'
queryset = User.objects.all()
serializer_class = UserSerializer


class UserListAPI(generics.ListCreateAPIView):
"""
API endpoint used to get a complete list of users
and create a new user.
"""
queryset = User.objects.all()
serializer_class = UserSerializer

0 comments on commit 2888fa2

Please sign in to comment.