diff --git a/nsupdate/accounts/__init__.py b/nsupdate/accounts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/nsupdate/accounts/models.py b/nsupdate/accounts/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/nsupdate/accounts/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/nsupdate/main/templates/main/user_profile.html b/nsupdate/accounts/templates/accounts/user_profile.html similarity index 100% rename from nsupdate/main/templates/main/user_profile.html rename to nsupdate/accounts/templates/accounts/user_profile.html diff --git a/nsupdate/nsupdate/templates/registration/activate.html b/nsupdate/accounts/templates/registration/activate.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/activate.html rename to nsupdate/accounts/templates/registration/activate.html diff --git a/nsupdate/nsupdate/templates/registration/activation_complete.html b/nsupdate/accounts/templates/registration/activation_complete.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/activation_complete.html rename to nsupdate/accounts/templates/registration/activation_complete.html diff --git a/nsupdate/nsupdate/templates/registration/activation_email.html b/nsupdate/accounts/templates/registration/activation_email.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/activation_email.html rename to nsupdate/accounts/templates/registration/activation_email.html diff --git a/nsupdate/nsupdate/templates/registration/activation_email.txt b/nsupdate/accounts/templates/registration/activation_email.txt similarity index 100% rename from nsupdate/nsupdate/templates/registration/activation_email.txt rename to nsupdate/accounts/templates/registration/activation_email.txt diff --git a/nsupdate/nsupdate/templates/registration/activation_email_subject.txt b/nsupdate/accounts/templates/registration/activation_email_subject.txt similarity index 100% rename from nsupdate/nsupdate/templates/registration/activation_email_subject.txt rename to nsupdate/accounts/templates/registration/activation_email_subject.txt diff --git a/nsupdate/nsupdate/templates/registration/login.html b/nsupdate/accounts/templates/registration/login.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/login.html rename to nsupdate/accounts/templates/registration/login.html diff --git a/nsupdate/nsupdate/templates/registration/logout.html b/nsupdate/accounts/templates/registration/logout.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/logout.html rename to nsupdate/accounts/templates/registration/logout.html diff --git a/nsupdate/nsupdate/templates/registration/password_change.html b/nsupdate/accounts/templates/registration/password_change.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/password_change.html rename to nsupdate/accounts/templates/registration/password_change.html diff --git a/nsupdate/nsupdate/templates/registration/password_change_done.html b/nsupdate/accounts/templates/registration/password_change_done.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/password_change_done.html rename to nsupdate/accounts/templates/registration/password_change_done.html diff --git a/nsupdate/nsupdate/templates/registration/password_reset_complete.html b/nsupdate/accounts/templates/registration/password_reset_complete.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/password_reset_complete.html rename to nsupdate/accounts/templates/registration/password_reset_complete.html diff --git a/nsupdate/nsupdate/templates/registration/password_reset_confirm.html b/nsupdate/accounts/templates/registration/password_reset_confirm.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/password_reset_confirm.html rename to nsupdate/accounts/templates/registration/password_reset_confirm.html diff --git a/nsupdate/nsupdate/templates/registration/password_reset_done.html b/nsupdate/accounts/templates/registration/password_reset_done.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/password_reset_done.html rename to nsupdate/accounts/templates/registration/password_reset_done.html diff --git a/nsupdate/nsupdate/templates/registration/password_reset_email.html b/nsupdate/accounts/templates/registration/password_reset_email.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/password_reset_email.html rename to nsupdate/accounts/templates/registration/password_reset_email.html diff --git a/nsupdate/nsupdate/templates/registration/password_reset_form.html b/nsupdate/accounts/templates/registration/password_reset_form.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/password_reset_form.html rename to nsupdate/accounts/templates/registration/password_reset_form.html diff --git a/nsupdate/nsupdate/templates/registration/registration_base.html b/nsupdate/accounts/templates/registration/registration_base.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/registration_base.html rename to nsupdate/accounts/templates/registration/registration_base.html diff --git a/nsupdate/nsupdate/templates/registration/registration_complete.html b/nsupdate/accounts/templates/registration/registration_complete.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/registration_complete.html rename to nsupdate/accounts/templates/registration/registration_complete.html diff --git a/nsupdate/nsupdate/templates/registration/registration_form.html b/nsupdate/accounts/templates/registration/registration_form.html similarity index 100% rename from nsupdate/nsupdate/templates/registration/registration_form.html rename to nsupdate/accounts/templates/registration/registration_form.html diff --git a/nsupdate/accounts/tests.py b/nsupdate/accounts/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/nsupdate/accounts/tests.py @@ -0,0 +1,16 @@ +""" +This file demonstrates writing tests using the unittest module. These will pass +when you run "manage.py test". + +Replace this with more appropriate tests for your application. +""" + +from django.test import TestCase + + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.assertEqual(1 + 1, 2) diff --git a/nsupdate/accounts/urls.py b/nsupdate/accounts/urls.py new file mode 100644 index 0000000..054ac09 --- /dev/null +++ b/nsupdate/accounts/urls.py @@ -0,0 +1,14 @@ +from django.conf.urls import patterns, include, url +from accounts.views import ( + UserProfileView +) +from django.contrib.auth.views import password_change + +urlpatterns = patterns('', + url(r'^profile/', UserProfileView.as_view(), name="account_profile"), + url(r'^change_pw/', password_change, { + 'template_name': 'registration/password_change.html', + 'post_change_redirect': '/account/profile/', + }, + name="password_change"), +) diff --git a/nsupdate/accounts/views.py b/nsupdate/accounts/views.py new file mode 100644 index 0000000..23adef5 --- /dev/null +++ b/nsupdate/accounts/views.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from django.views.generic import TemplateView + + +class UserProfileView(TemplateView): + template_name = "accounts/user_profile.html" + + def get_context_data(self, *args, **kwargs): + context = super(UserProfileView, self).get_context_data(*args, **kwargs) + context['nav_user_profile'] = True + return context + + +class PasswordChangeView(TemplateView): + template_name = "registration/password_change.html" + + def get_context_data(self, *args, **kwargs): + context = super(PasswordChangeView, self).get_context_data(*args, **kwargs) + context['nav_change_password'] = True + return context + diff --git a/nsupdate/main/urls.py b/nsupdate/main/urls.py index 2ab0ddb..032526d 100644 --- a/nsupdate/main/urls.py +++ b/nsupdate/main/urls.py @@ -1,17 +1,10 @@ from django.conf.urls import patterns, include, url from main.views import ( - HomeView, MyIpView, OverviewView, UserProfileView + HomeView, MyIpView, OverviewView ) -from django.contrib.auth.views import password_change urlpatterns = patterns('', url(r'^$', HomeView.as_view(), name="home"), url(r'^overview/', OverviewView.as_view(), name="overview"), url(r'^myip/', MyIpView), - url(r'^account/profile/', UserProfileView.as_view(), name="account_profile"), - url(r'^account/change_pw/', password_change, { - 'template_name': 'registration/password_change.html', - 'post_change_redirect': '/account/profile/', - }, - name="password_change"), ) diff --git a/nsupdate/main/views.py b/nsupdate/main/views.py index cb93c03..63dc82d 100644 --- a/nsupdate/main/views.py +++ b/nsupdate/main/views.py @@ -30,20 +30,3 @@ def MyIpView(request): json.dumps({'ip': request.META['REMOTE_ADDR']}), content_type="application/json") - -class UserProfileView(TemplateView): - template_name = "main/user_profile.html" - - def get_context_data(self, *args, **kwargs): - context = super(UserProfileView, self).get_context_data(*args, **kwargs) - context['nav_user_profile'] = True - return context - - -class PasswordChangeView(TemplateView): - template_name = "registration/password_change.html" - - def get_context_data(self, *args, **kwargs): - context = super(PasswordChangeView, self).get_context_data(*args, **kwargs) - context['nav_change_password'] = True - return context diff --git a/nsupdate/nsupdate/settings.py b/nsupdate/nsupdate/settings.py index 84393ea..b8a0ca9 100644 --- a/nsupdate/nsupdate/settings.py +++ b/nsupdate/nsupdate/settings.py @@ -142,6 +142,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'south', 'nsupdate', + 'accounts', 'main', 'bootstrapform', 'registration', diff --git a/nsupdate/nsupdate/urls.py b/nsupdate/nsupdate/urls.py index 8e8508d..e97723d 100644 --- a/nsupdate/nsupdate/urls.py +++ b/nsupdate/nsupdate/urls.py @@ -6,6 +6,7 @@ admin.autodiscover() urlpatterns = patterns('', url(r'^accounts/', include('registration.backends.default.urls')), + url(r'^account/', include('accounts.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^', include('main.urls')), )