split up into new app accounts
This commit is contained in:
parent
9be82a5d01
commit
ec2b8ab88a
0
nsupdate/accounts/__init__.py
Normal file
0
nsupdate/accounts/__init__.py
Normal file
3
nsupdate/accounts/models.py
Normal file
3
nsupdate/accounts/models.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
16
nsupdate/accounts/tests.py
Normal file
16
nsupdate/accounts/tests.py
Normal file
@ -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)
|
14
nsupdate/accounts/urls.py
Normal file
14
nsupdate/accounts/urls.py
Normal file
@ -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"),
|
||||
)
|
21
nsupdate/accounts/views.py
Normal file
21
nsupdate/accounts/views.py
Normal file
@ -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
|
||||
|
@ -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"),
|
||||
)
|
||||
|
@ -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
|
||||
|
@ -142,6 +142,7 @@ INSTALLED_APPS = (
|
||||
'django.contrib.admin',
|
||||
'south',
|
||||
'nsupdate',
|
||||
'accounts',
|
||||
'main',
|
||||
'bootstrapform',
|
||||
'registration',
|
||||
|
@ -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')),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user