From d7b19108392b337aa6e09c944107623756f90a27 Mon Sep 17 00:00:00 2001 From: Matthew Dillon <matthewrdillon@gmail.com> Date: Wed, 8 Jun 2016 11:49:05 -0700 Subject: [PATCH] Clean out stuff --- ccdb/contrib/__init__.py | 1 - ccdb/contrib/sites/__init__.py | 1 - ccdb/contrib/sites/migrations/0001_initial.py | 31 ------ .../0002_set_site_domain_and_name.py | 40 ------- .../migrations/0003_auto_20151221_2141.py | 21 ---- ccdb/contrib/sites/migrations/__init__.py | 1 - ccdb/static/{fonts => }/.gitkeep | 0 ccdb/static/css/project.css | 22 ---- ccdb/static/images/favicon.ico | Bin 8348 -> 0 bytes ccdb/static/js/project.js | 1 - ccdb/static/sass/project.scss | 51 --------- ccdb/templates/404.html | 9 -- ccdb/templates/500.html | 14 --- ccdb/templates/account/base.html | 6 -- ccdb/templates/account/email.html | 76 -------------- ccdb/templates/account/email_confirm.html | 35 ------- ccdb/templates/account/email_confirmed.html | 21 ---- ccdb/templates/account/login.html | 25 ----- ccdb/templates/account/logout.html | 22 ---- ccdb/templates/account/password_change.html | 18 ---- ccdb/templates/account/password_reset.html | 38 ------- .../account/password_reset_done.html | 23 ---- .../account/password_reset_from_key.html | 40 ------- .../account/password_reset_from_key_done.html | 13 --- ccdb/templates/account/password_set.html | 19 ---- ccdb/templates/account/signup.html | 29 ----- ccdb/templates/account/signup_closed.html | 14 --- ccdb/templates/account/verification_sent.html | 20 ---- .../account/verified_email_required.html | 34 ------ ccdb/templates/base.html | 99 ------------------ ccdb/templates/django_tables2/table.html | 58 ---------- ccdb/templates/pages/about.html | 6 -- ccdb/templates/pages/home.html | 7 -- ccdb/templates/users/user_detail.html | 28 ----- ccdb/templates/users/user_form.html | 19 ---- ccdb/templates/users/user_list.html | 14 --- ccdb/users/admin.py | 3 - ccdb/users/models.py | 7 +- ccdb/users/tests/__init__.py | 0 ccdb/users/tests/factories.py | 11 -- ccdb/users/tests/test_admin.py | 39 ------- ccdb/users/tests/test_models.py | 18 ---- ccdb/users/tests/test_views.py | 66 ------------ ccdb/users/urls.py | 14 --- ccdb/users/views.py | 51 --------- config/settings/base.py | 22 +--- config/urls.py | 15 +-- 47 files changed, 13 insertions(+), 1089 deletions(-) delete mode 100644 ccdb/contrib/__init__.py delete mode 100644 ccdb/contrib/sites/__init__.py delete mode 100644 ccdb/contrib/sites/migrations/0001_initial.py delete mode 100644 ccdb/contrib/sites/migrations/0002_set_site_domain_and_name.py delete mode 100644 ccdb/contrib/sites/migrations/0003_auto_20151221_2141.py delete mode 100644 ccdb/contrib/sites/migrations/__init__.py rename ccdb/static/{fonts => }/.gitkeep (100%) delete mode 100644 ccdb/static/css/project.css delete mode 100644 ccdb/static/images/favicon.ico delete mode 100644 ccdb/static/js/project.js delete mode 100644 ccdb/static/sass/project.scss delete mode 100644 ccdb/templates/404.html delete mode 100644 ccdb/templates/500.html delete mode 100644 ccdb/templates/account/base.html delete mode 100644 ccdb/templates/account/email.html delete mode 100644 ccdb/templates/account/email_confirm.html delete mode 100644 ccdb/templates/account/email_confirmed.html delete mode 100644 ccdb/templates/account/login.html delete mode 100644 ccdb/templates/account/logout.html delete mode 100644 ccdb/templates/account/password_change.html delete mode 100644 ccdb/templates/account/password_reset.html delete mode 100644 ccdb/templates/account/password_reset_done.html delete mode 100644 ccdb/templates/account/password_reset_from_key.html delete mode 100644 ccdb/templates/account/password_reset_from_key_done.html delete mode 100644 ccdb/templates/account/password_set.html delete mode 100644 ccdb/templates/account/signup.html delete mode 100644 ccdb/templates/account/signup_closed.html delete mode 100644 ccdb/templates/account/verification_sent.html delete mode 100644 ccdb/templates/account/verified_email_required.html delete mode 100644 ccdb/templates/base.html delete mode 100644 ccdb/templates/django_tables2/table.html delete mode 100644 ccdb/templates/pages/about.html delete mode 100644 ccdb/templates/pages/home.html delete mode 100644 ccdb/templates/users/user_detail.html delete mode 100644 ccdb/templates/users/user_form.html delete mode 100644 ccdb/templates/users/user_list.html delete mode 100644 ccdb/users/tests/__init__.py delete mode 100644 ccdb/users/tests/factories.py delete mode 100644 ccdb/users/tests/test_admin.py delete mode 100644 ccdb/users/tests/test_models.py delete mode 100644 ccdb/users/tests/test_views.py delete mode 100644 ccdb/users/urls.py delete mode 100644 ccdb/users/views.py diff --git a/ccdb/contrib/__init__.py b/ccdb/contrib/__init__.py deleted file mode 100644 index 40a96af..0000000 --- a/ccdb/contrib/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/ccdb/contrib/sites/__init__.py b/ccdb/contrib/sites/__init__.py deleted file mode 100644 index 40a96af..0000000 --- a/ccdb/contrib/sites/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/ccdb/contrib/sites/migrations/0001_initial.py b/ccdb/contrib/sites/migrations/0001_initial.py deleted file mode 100644 index 555d02c..0000000 --- a/ccdb/contrib/sites/migrations/0001_initial.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import django.contrib.sites.models - - -class Migration(migrations.Migration): - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Site', - fields=[ - ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)), - ('domain', models.CharField(verbose_name='domain name', max_length=100, validators=[django.contrib.sites.models._simple_domain_name_validator])), - ('name', models.CharField(verbose_name='display name', max_length=50)), - ], - options={ - 'verbose_name_plural': 'sites', - 'verbose_name': 'site', - 'db_table': 'django_site', - 'ordering': ('domain',), - }, - managers=[ - (b'objects', django.contrib.sites.models.SiteManager()), - ], - ), - ] diff --git a/ccdb/contrib/sites/migrations/0002_set_site_domain_and_name.py b/ccdb/contrib/sites/migrations/0002_set_site_domain_and_name.py deleted file mode 100644 index aea3458..0000000 --- a/ccdb/contrib/sites/migrations/0002_set_site_domain_and_name.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations - - -def update_site_forward(apps, schema_editor): - """Set site domain and name.""" - Site = apps.get_model("sites", "Site") - Site.objects.update_or_create( - id=settings.SITE_ID, - defaults={ - "domain": "ccdb.info", - "name": "ccdb" - } - ) - - -def update_site_backward(apps, schema_editor): - """Revert site domain and name to default.""" - Site = apps.get_model("sites", "Site") - Site.objects.update_or_create( - id=settings.SITE_ID, - defaults={ - "domain": "example.com", - "name": "example.com" - } - ) - - -class Migration(migrations.Migration): - - dependencies = [ - ('sites', '0001_initial'), - ] - - operations = [ - migrations.RunPython(update_site_forward, update_site_backward), - ] diff --git a/ccdb/contrib/sites/migrations/0003_auto_20151221_2141.py b/ccdb/contrib/sites/migrations/0003_auto_20151221_2141.py deleted file mode 100644 index 832c4ad..0000000 --- a/ccdb/contrib/sites/migrations/0003_auto_20151221_2141.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models -import django.contrib.sites.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sites', '0002_set_site_domain_and_name'), - ] - - operations = [ - migrations.AlterModelManagers( - name='site', - managers=[ - ('objects', django.contrib.sites.models.SiteManager()), - ], - ), - ] diff --git a/ccdb/contrib/sites/migrations/__init__.py b/ccdb/contrib/sites/migrations/__init__.py deleted file mode 100644 index 40a96af..0000000 --- a/ccdb/contrib/sites/migrations/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/ccdb/static/fonts/.gitkeep b/ccdb/static/.gitkeep similarity index 100% rename from ccdb/static/fonts/.gitkeep rename to ccdb/static/.gitkeep diff --git a/ccdb/static/css/project.css b/ccdb/static/css/project.css deleted file mode 100644 index f24ff66..0000000 --- a/ccdb/static/css/project.css +++ /dev/null @@ -1,22 +0,0 @@ -.alert-debug { - background-color: #fff; - border-color: #d6e9c6; - color: #000; } - -.alert-error { - background-color: #f2dede; - border-color: #eed3d7; - color: #b94a48; } - -@media (max-width: 47.9em) { - .navbar-nav .nav-item { - display: inline-block; - float: none; - width: 100%; } - .navbar-nav .nav-item + .nav-item { - margin-left: 0; } - .nav.navbar-nav.pull-right { - float: none !important; } } - -[hidden][style="display: block;"] { - display: block !important; } diff --git a/ccdb/static/images/favicon.ico b/ccdb/static/images/favicon.ico deleted file mode 100644 index e1c1dd1a32a3a077c41a21e52bc7fb5ac90d3afb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8348 zcmeHLX-gGh6rQ3V&`<D7CE<noAlEjsXwxujXd#F)ld{xou?49lT4^C#DMQg92<lcw zMzolfs1@y^S<!}Aws>92%;lcmGu`Jl^WK@OV`^XKh08PZoaH%l?rdiiWq>kJ2@6vM zhAH8L6=kTRD1!xR`-2o^hS&}loN!U1#gF+=YxEq~uqf5#iBw%p0;w;5ehm+6a!sSu zh;X+$+}oF$X1Q6DwS~>Y_Hpw^(&QvJO<5ZCPrn5l<LUX!$CQ2UuxTFFU@d=5o~T)_ zM&9lX?aYJe)cC!DuyW2Hv#fzNBja7o{yI$k?DQi4Qa1T~osibBqqBpOvgVuShAz;K zmYFZ>aNp%s{<NfD^tq;K$)o9J`Bk|DTDfaUPz^Y4pxH6?go{g!rZ4q%h8hZr&i<2r zT*`Rbm$#it9u?E4ueH?P(XQoh{?VjqRllpGTlcTg>B3x1hf%*?eW>oS{<{4s^u_yG zpDyG!_iV#~G=q<~slG@0Sx47XXQ%O;HY7ILVf}<nvkjKkUq5Z@&&!CV?=8)SJU*X~ zs@_!4mAeIW{>B-)R$6GV^A78)t0tN9`tu3r9Z+xM?NgUd8geu=c`0?r;-KR&IQjKs zSB#VCpg8CPW&M}$sth@H=VS%t;23!!j};F)bb;W3EkA!4QmCsY_p81^T<lC2Jw<JL zl>K0{;$g>e1Hl998^0M+r0-7ZSN+l_cMSRuEALTE@|d6+3{GMP^;_|<<G6v~fm@Db z$SJ7$Z6)nIxtS6-&!vT#DsfNbg?K9-cIX1Z>yhubb{FF1IPgH|0>SH%pC!c)uFI)H z?jv4y0uO{P5WE>~I<$r!RFo0lN4r{xm;Jy4p$h~b3S*a#)$Z*nI}&Kc_C+*zZHz1v zIR8TBVH<RTUHMzt<pQkyWFERe+1}lKD}5^-d7%pgZx^j}ta#*yE)cw3G}D>7Y?Mp~ zofpsr+SP@>EX4e*bQ{nAUYtKrQ&-5d4j;FF{^-^Dt2^5I`HSb!|22PN26n3>hKPOy zW<i`2eS&}fZx3to{LSA9#ODI-3qh#w1a37VHY(or(QZwVGl$n`v8t<fVnSrlb)f&h zX0M(~Jg?;!WC#2>2D*A*v+c{bFKCwozbB{dObp~e&1Nxrj<4Ih4~w)M`nl08o}Wq2 z#Jt(k+M>+}JY(=2gm(gdUq)^@e%tX(F)RBtotnB2^y>YKz-5eg_qO&n%lJ1nuQmTY zxmyE1NWjl1EGvD?Z|n;neT;sa?Q;Ef-#%$BYxXAhD4xF+@M>*qrR!x^sPN98|BX4; z!$NJcKF`^C7f(<_vlp%b>`pxL^8Y<&?KFx{n_!5C9VqLA*CP@zhXs2t#dmrAKu?d_ y^&_r5_e@uesG}CO*g!3o?-kB+I^cA`>44J#rvpw0oDMi0a5~_0!0Eu>4*Uj$LD0AW diff --git a/ccdb/static/js/project.js b/ccdb/static/js/project.js deleted file mode 100644 index d26d23b..0000000 --- a/ccdb/static/js/project.js +++ /dev/null @@ -1 +0,0 @@ -/* Project specific Javascript goes here. */ diff --git a/ccdb/static/sass/project.scss b/ccdb/static/sass/project.scss deleted file mode 100644 index 37c69e4..0000000 --- a/ccdb/static/sass/project.scss +++ /dev/null @@ -1,51 +0,0 @@ -// project specific CSS goes here - -// Alert colors - -$white: #fff; -$mint-green: #d6e9c6; -$black: #000; -$pink: #f2dede; -$dark-pink: #eed3d7; -$red: #b94a48; - -// bootstrap alert CSS, translated to the django-standard levels of -// debug, info, success, warning, error - -.alert-debug { - background-color: $white; - border-color: $mint-green; - color: $black; -} - -.alert-error { - background-color: $pink; - border-color: $dark-pink; - color: $red; -} - -// This is a fix for the bootstrap4 alpha release - -@media (max-width: 47.9em) { - .navbar-nav .nav-item { - display: inline-block; - float: none; - width: 100%; - } - - .navbar-nav .nav-item + .nav-item { - margin-left: 0; - } - - .nav.navbar-nav.pull-right { - float: none !important; - } -} - -// Display django-debug-toolbar. -// See https://github.com/django-debug-toolbar/django-debug-toolbar/issues/742 -// and https://github.com/pydanny/cookiecutter-django/issues/317 - -[hidden][style="display: block;"] { - display: block !important; -} diff --git a/ccdb/templates/404.html b/ccdb/templates/404.html deleted file mode 100644 index b9cb608..0000000 --- a/ccdb/templates/404.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Page Not found{% endblock %} - -{% block content %} -<h1>Page Not found</h1> - -<p>This is not the page you were looking for.</p> -{% endblock content %} diff --git a/ccdb/templates/500.html b/ccdb/templates/500.html deleted file mode 100644 index 919cf1c..0000000 --- a/ccdb/templates/500.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Server Error{% endblock %} - -{% block content %} -<h1>Error</h1> - -<h3>Sorry about that, it looks like something went wrong.</h3> - -<p> - We track these errors automatically, but if the problem persists feel free - to contact us. In the meantime, try refreshing. -</p> -{% endblock content %} diff --git a/ccdb/templates/account/base.html b/ccdb/templates/account/base.html deleted file mode 100644 index 4c86ad8..0000000 --- a/ccdb/templates/account/base.html +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "base.html" %} - -{% block title %} - {% block head_title %} - {% endblock head_title %} -{% endblock title %} diff --git a/ccdb/templates/account/email.html b/ccdb/templates/account/email.html deleted file mode 100644 index 490ea43..0000000 --- a/ccdb/templates/account/email.html +++ /dev/null @@ -1,76 +0,0 @@ -{% extends "account/base.html" %} -{% block navbar_class-users:detail %}active{% endblock %} - -{% load i18n %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Account" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "E-mail Addresses" %}</h2> - {% if user.emailaddress_set.all %} - <p>{% trans 'The following e-mail addresses are associated with your account:' %}</p> - <form action="{% url 'account_email' %}" class="email_list" method="post"> - {% csrf_token %} - <fieldset class="blockLabels"> - {% for emailaddress in user.emailaddress_set.all %} - <div class="ctrlHolder"> - <label for="email_radio_{{ forloop.counter }}" class="{% if emailaddress.primary %}primary_email{% endif %}"> - <input id="email_radio_{{ forloop.counter }}" type="radio" name="email" {% if emailaddress.primary %}checked="checked"{% endif %} value="{{ emailaddress.email }}"/> - {{ emailaddress.email }} - {% if emailaddress.verified %} - <span class="verified">{% trans "Verified" %}</span> - {% else %} - <span class="unverified">{% trans "Unverified" %}</span> - {% endif %} - {% if emailaddress.primary %} - <span class="primary">{% trans "Primary" %}</span> - {% endif %} - </label> - </div> - {% endfor %} - - <div class="btn-group" role="group"> - <input class="btn btn-primary" type="submit" value="{% trans 'Make Primary' %}" name="action_primary" /> - <input class="btn btn-success" type="submit" value="{% trans 'Re-send Verification' %}" name="action_send" /> - <input class="btn btn-danger" type="submit" value="{% trans 'Remove' %}" name="action_remove" /> - </div> - </fieldset> - </form> - {% else %} - <p> - <strong>{% trans 'Warning:'%}</strong> - {% blocktrans %} - You currently do not have any e-mail address set up. You should - really add an e-mail address so you can receive notifications, - reset your password, etc. - {% endblocktrans %} - </p> - {% endif %} - <h2>{% trans "Add E-mail Address" %}</h2> - <form method="post" action="." class="add_email"> - {% csrf_token %} - {{ form|crispy }} - <button class="btn btn-primary" name="action_add" type="submit">{% trans "Add E-mail" %}</button> - </form> - </div> -</div> -{% endblock %} - -{% block extra_body %} -<script type="text/javascript"> - (function() { - var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}"; - var actions = document.getElementsByName('action_remove'); - if (actions.length) { - actions[0].addEventListener("click", function(e) { - if (! confirm(message)) { - e.preventDefault(); - } - }); - } - })(); -</script> -{% endblock %} diff --git a/ccdb/templates/account/email_confirm.html b/ccdb/templates/account/email_confirm.html deleted file mode 100644 index 117f856..0000000 --- a/ccdb/templates/account/email_confirm.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load account %} - -{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-xs-12"> - <h2>{% trans "Confirm E-mail Address" %}</h2> - {% if confirmation %} - {% user_display confirmation.email_address.user as user_display %} - <p> - {% blocktrans with confirmation.email_address.email as email %} - Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> - is an e-mail address for user {{ user_display }}. - {% endblocktrans %} - </p> - <form method="post" action="{% url 'account_confirm_email' confirmation.key %}"> - {% csrf_token %} - <input class="btn btn-primary" type="submit" value="{% trans 'Confirm' %}" /> - </form> - {% else %} - {% url 'account_email' as email_url %} - <p> - {% blocktrans %} - This e-mail confirmation link expired or is invalid. Please - <a href="{{ email_url }}">issue a new e-mail confirmation request</a>. - {% endblocktrans %} - </p> - {% endif %} - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/email_confirmed.html b/ccdb/templates/account/email_confirmed.html deleted file mode 100644 index ed282f9..0000000 --- a/ccdb/templates/account/email_confirmed.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load account %} - -{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-xs-12"> - <h2>{% trans "Confirm E-mail Address" %}</h2> - {% user_display email_address.user as user_display %} - <p> - {% blocktrans with email_address.email as email %} - You have confirmed that <a href="mailto:{{ email }}">{{ email }}</a> - is an e-mail address for user {{ user_display }}. - {% endblocktrans %} - </p> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/login.html b/ccdb/templates/account/login.html deleted file mode 100644 index 4979147..0000000 --- a/ccdb/templates/account/login.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "account/base.html" %} -{% block navbar_class-account_login %}active{% endblock %} - -{% load i18n %} -{% load account %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Sign In" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "Sign In" %}</h2> - <form class="login" method="POST" action="{% url 'account_login' %}"> - {% csrf_token %} - {{ form|crispy }} - {% if redirect_field_value %} - <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" /> - {% endif %} - <button id="sign-in-button" class="btn btn-primary" type="submit">{% trans "Sign In" %}</button> - <a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a> - </form> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/logout.html b/ccdb/templates/account/logout.html deleted file mode 100644 index b55404b..0000000 --- a/ccdb/templates/account/logout.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "account/base.html" %} -{% block navbar_class-account_logout %}active{% endblock %} - -{% load i18n %} - -{% block head_title %}{% trans "Sign Out" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "Sign Out" %}</h2> - <p>{% trans 'Are you sure you want to sign out?' %}</p> - <form method="post" action="{% url 'account_logout' %}"> - {% csrf_token %} - {% if redirect_field_value %} - <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/> - {% endif %} - <button class="btn btn-danger" type="submit">{% trans 'Sign Out' %}</button> - </form> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/password_change.html b/ccdb/templates/account/password_change.html deleted file mode 100644 index ee373bb..0000000 --- a/ccdb/templates/account/password_change.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load crispy_forms_tags %} -{% block head_title %}{% trans "Change Password" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "Change Password" %}</h2> - <form method="POST" action="./" class="password_change"> - {% csrf_token %} - {{ form|crispy }} - <button class="btn btn-primary" type="submit" name="action">{% trans "Change Password" %}</button> - </form> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/password_reset.html b/ccdb/templates/account/password_reset.html deleted file mode 100644 index 57b8c6d..0000000 --- a/ccdb/templates/account/password_reset.html +++ /dev/null @@ -1,38 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load account %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Password Reset" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "Password Reset" %}</h2> - {% if user.is_authenticated %} - {% include "account/snippets/already_logged_in.html" %} - {% endif %} - <p> - {% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %} - </p> - <form method="POST" action="./" class="password_reset"> - {% csrf_token %} - {{ form|crispy }} - <button class="btn btn-primary" type="submit">{% trans "Reset My Password" %}</button> - </form> - <p> - {% blocktrans %} - Please contact us if you have any trouble resetting your password. - {% endblocktrans %} - </p> - </div> -</div> -{% endblock %} - -{% block javascript %} -{{ block.super }} -<script> - $("#id_email").focus(); -</script> -{% endblock javascript %} diff --git a/ccdb/templates/account/password_reset_done.html b/ccdb/templates/account/password_reset_done.html deleted file mode 100644 index 3835608..0000000 --- a/ccdb/templates/account/password_reset_done.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load account %} - -{% block head_title %}{% trans "Password Reset" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-xs-12"> - <h2>{% trans "Password Reset" %}</h2> - {% if user.is_authenticated %} - {% include "account/snippets/already_logged_in.html" %} - {% endif %} - <p> - {% blocktrans %} - We have sent you an e-mail. Please contact us if you do not - receive it within a few minutes. - {% endblocktrans %} - </p> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/password_reset_from_key.html b/ccdb/templates/account/password_reset_from_key.html deleted file mode 100644 index 94a2af6..0000000 --- a/ccdb/templates/account/password_reset_from_key.html +++ /dev/null @@ -1,40 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Change Password" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-xs-12"> - <h2> - {% if token_fail %} - {% trans "Bad Token" %} - {% else %} - {% trans "Change Password" %} - {% endif %} - </h2> - {% if token_fail %} - {% url 'account_reset_password' as passwd_reset_url %} - <p> - {% blocktrans %} - The password reset link was invalid, possibly because it has already - been used. Please request a <a href="{{ passwd_reset_url }}">new - password reset</a>. - {% endblocktrans %} - </p> - {% else %} - {% if form %} - <form method="POST" action="./"> - {% csrf_token %} - {{ form|crispy }} - <button class="btn btn-primary" type="submit" name="action">{% trans "change password" %}</button> - </form> - {% else %} - <p>{% trans 'Your password is now changed.' %}</p> - {% endif %} - {% endif %} - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/password_reset_from_key_done.html b/ccdb/templates/account/password_reset_from_key_done.html deleted file mode 100644 index 8440069..0000000 --- a/ccdb/templates/account/password_reset_from_key_done.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% block head_title %}{% trans "Change Password" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "Change Password" %}</h2> - <p>{% trans 'Your password is now changed.' %}</p> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/password_set.html b/ccdb/templates/account/password_set.html deleted file mode 100644 index d5c39f6..0000000 --- a/ccdb/templates/account/password_set.html +++ /dev/null @@ -1,19 +0,0 @@ - -{% extends "account/base.html" %} - -{% load i18n crispy_forms_tags %} - -{% block head_title %}{% trans "Set Password" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "Set Password" %}</h2> - <form method="POST" action="./" class="password_set"> - {% csrf_token %} - {{ form|crispy }} - <input type="submit" name="action" value="{% trans "Set Password" %}"/> - </form> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/signup.html b/ccdb/templates/account/signup.html deleted file mode 100644 index 217df06..0000000 --- a/ccdb/templates/account/signup.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends "account/base.html" %} -{% block navbar_class-account_signup %}active{% endblock %} - -{% load i18n %} -{% load crispy_forms_tags %} - -{% block title %}{% trans "Signup" %}{% endblock title %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h1>{% trans "Sign Up" %}</h1> - <p> - {% blocktrans %} - Already have an account? Then please - <a href="{{ login_url }}">sign in</a>. - {% endblocktrans %} - </p> - <form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}"> - {% csrf_token %} - {{ form|crispy }} - {% if redirect_field_value %} - <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" /> - {% endif %} - <button id="sign-up-button" class="btn btn-primary" type="submit">{% trans "Sign Up" %}</button> - </form> - </div> -</div> -{% endblock content %} diff --git a/ccdb/templates/account/signup_closed.html b/ccdb/templates/account/signup_closed.html deleted file mode 100644 index c18daf7..0000000 --- a/ccdb/templates/account/signup_closed.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} - -{% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "Sign Up Closed" %}</h2> - <p>{% trans "We are sorry, but the sign up is currently closed." %}</p> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/verification_sent.html b/ccdb/templates/account/verification_sent.html deleted file mode 100644 index b23e4c8..0000000 --- a/ccdb/templates/account/verification_sent.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} - -{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "Verify Your E-mail Address" %}</h2> - <p> - {% blocktrans %} - We have sent an e-mail to <a href="mailto:{{ email }}">{{ email }}</a> - for verification. Follow the link provided to finalize the signup - process. Please contact us if you do not receive it within a few minutes. - {% endblocktrans %} - </p> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/account/verified_email_required.html b/ccdb/templates/account/verified_email_required.html deleted file mode 100644 index d844a4a..0000000 --- a/ccdb/templates/account/verified_email_required.html +++ /dev/null @@ -1,34 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} - -{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-md-5"> - <h2>{% trans "Verify Your E-mail Address" %}</h2> - {% url 'account_email' as email_url %} - <p> - {% blocktrans %} - This part of the site requires us to verify that you are who you claim - to be. For this purpose, we require that you verify ownership of your - e-mail address. - {% endblocktrans %} - </p> - <p> - {% blocktrans %} - We have sent an e-mail to you for verification. Please click on the - link inside this e-mail. Please contact us if you do not receive it - within a few minutes. - {% endblocktrans %} - </p> - <p> - {% blocktrans %} - <strong>Note:</strong> you can still <a href="{{ email_url }}">change - your e-mail address</a>. - {% endblocktrans %} - </p> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/base.html b/ccdb/templates/base.html deleted file mode 100644 index 42e702b..0000000 --- a/ccdb/templates/base.html +++ /dev/null @@ -1,99 +0,0 @@ -{% load staticfiles %} -{% load i18n %} - -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8"> - <meta http-equiv="x-ua-compatible" content="ie=edge"> - <title>{% block title %}CCDB{% endblock title %}</title> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="description" content=""> - <meta name="author" content=""> - - <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> - <!--[if lt IE 9]> - <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - - {% block css %} - <link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/flatly/bootstrap.min.css" rel="stylesheet" integrity="sha256-sHwgyDk4CGNYom267UJX364ewnY4Bh55d53pxP5WDug= sha512-mkkeSf+MM3dyMWg3k9hcAttl7IVHe2BA1o/5xKLl4kBaP0bih7Mzz/DBy4y6cNZCHtE2tPgYBYH/KtEjOQYKxA==" crossorigin="anonymous"> - <link href="{% static 'css/project.css' %}" rel="stylesheet"> - {% endblock %} - </head> - - <body> - <div> - <nav class="navbar navbar-default navbar-static-top"> - <div class="container-fluid"> - <div class="navbar-header"> - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> - <span class="sr-only">Toggle navigation</span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - <a class="navbar-brand" href="{% url 'home' %}">CCDB</a> - </div> - - <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> - <ul class="nav navbar-nav"> - {% if request.user.is_authenticated %} - <li class="nav-item {% block navbar_class-projects %}{% endblock %}"> - <a class="nav-link" href="{% url 'admin:index' %}"> - {% trans "Admin" %} - </a> - </li> - {% endif %} - </ul> - <ul class="nav navbar-nav pull-right"> - {% if request.user.is_authenticated %} - <li class="nav-item {% block navbar_class-users:detail %}{% endblock %}"> - <a class="nav-link" href="{% url 'users:detail' request.user.username %}"> - {% trans "My Profile" %} - </a> - </li> - <li class="nav-item {% block navbar_class-account_logout %}{% endblock %}"> - <a class="nav-link" href="{% url 'account_logout' %}"> - {% trans "Logout" %} - </a> - </li> - {% else %} - <li class="nav-item {% block navbar_class-account_signup %}{% endblock %}"> - <a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}"> - {% trans "Sign Up" %} - </a> - </li> - <li class="nav-item {% block navbar_class-account_login %}{% endblock %}"> - <a id="log-in-link" class="nav-link" href="{% url 'account_login' %}"> - {% trans "Log In" %} - </a> - </li> - {% endif %} - </ul> - </div> - </div> - </nav> - </div> - - <div class="container"> - {% if messages %} - {% for message in messages %} - <div class="alert {% if message.tags %}alert-{{ message.tags }}"{% endif %}>{{ message }}</div> - {% endfor %} - {% endif %} - - {% block content %} - <p>PLACEHOLDER</p> - {% endblock content %} - </div> - - {% block modal %}{% endblock modal %} - - {% block javascript %} - <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> - <script src="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/js/bootstrap.js"></script> - <script src="{% static 'js/project.js' %}"></script> - {% endblock javascript %} - </body> -</html> diff --git a/ccdb/templates/django_tables2/table.html b/ccdb/templates/django_tables2/table.html deleted file mode 100644 index 306149d..0000000 --- a/ccdb/templates/django_tables2/table.html +++ /dev/null @@ -1,58 +0,0 @@ -{% load querystring from django_tables2 %} -{% load title from django_tables2 %} -{% load trans blocktrans from i18n %} -{% load bootstrap3 %} - -{% if table.page %} - <div class="table-container"> -{% endif %} - -{% block table %} -<table class="table table-striped"{% if table.attrs %} {{ table.attrs.as_html }}{% endif %}> - {% block table.thead %} - <thead> - <tr> - {% for column in table.columns %} - {% if column.orderable %} - <th {{ column.attrs.th.as_html }}><a href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">{{ column.header|title }}</a></th> - {% else %} - <th {{ column.attrs.th.as_html }}>{{ column.header|title }}</th> - {% endif %} - {% endfor %} - </tr> - </thead> - {% endblock table.thead %} - {% block table.tbody %} - <tbody> - {% for row in table.page.object_list|default:table.rows %} {# support pagination #} - {% block table.tbody.row %} - <tr class="{% cycle "odd" "even" %}"> - {% for column, cell in row.items %} - <td {{ column.attrs.td.as_html }}>{{ cell }}</td> - {% endfor %} - </tr> - {% endblock table.tbody.row %} - {% empty %} - {% if table.empty_text %} - {% block table.tbody.empty_text %} - <tr><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr> - {% endblock table.tbody.empty_text %} - {% endif %} - {% endfor %} - </tbody> - {% endblock table.tbody %} - {% block table.tfoot %} - <tfoot></tfoot> - {% endblock table.tfoot %} -</table> -{% endblock table %} - -{% if table.page %} - {% block pagination %} - {% bootstrap_pagination table.page url=request.get_full_path %} - {% endblock pagination %} -{% endif %} - -{% if table.page %} - </div> -{% endif %} diff --git a/ccdb/templates/pages/about.html b/ccdb/templates/pages/about.html deleted file mode 100644 index 241d395..0000000 --- a/ccdb/templates/pages/about.html +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "base.html" %} -{% block navbar_class-about %}active{% endblock %} - -{% block content %} -<h1>About</h1> -{% endblock content %} diff --git a/ccdb/templates/pages/home.html b/ccdb/templates/pages/home.html deleted file mode 100644 index 7a7e2dd..0000000 --- a/ccdb/templates/pages/home.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -<h1>CCDB</h1> - -<p>This page will have overview data.</p> -{% endblock content %} diff --git a/ccdb/templates/users/user_detail.html b/ccdb/templates/users/user_detail.html deleted file mode 100644 index f374b9f..0000000 --- a/ccdb/templates/users/user_detail.html +++ /dev/null @@ -1,28 +0,0 @@ -{% extends "base.html" %} -{% block navbar_class-users:detail %}active{% endblock %} -{% load static %} - -{% block title %}User: {{ object.username }}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-sm-12"> - <h1>{{ object.username }}</h1> - {% if object.name %} - <p>{{ object.name }}</p> - {% endif %} - </div> -</div> - -{% if object == request.user %} -<!-- Action buttons --> -<div class="row"> - <div class="col-sm-12 "> - <a class="btn btn-primary" href="{% url 'users:update' username=request.user.username %}">My Info</a> - <a class="btn btn-primary" href="{% url 'account_email' %}">E-Mail</a> - <!-- Your Stuff: Custom user template urls --> - </div> -</div> -<!-- End Action buttons --> -{% endif %} -{% endblock content %} diff --git a/ccdb/templates/users/user_form.html b/ccdb/templates/users/user_form.html deleted file mode 100644 index 46842dc..0000000 --- a/ccdb/templates/users/user_form.html +++ /dev/null @@ -1,19 +0,0 @@ -{% extends "base.html" %} -{% block navbar_class-users:detail %}active{% endblock %} -{% load crispy_forms_tags %} -{% load static %} - -{% block title %}{{ user.username }}{% endblock %} - -{% block content %} -<div class="row"> - <div class="col-sm-12"> - <h1>{{ user.username }}</h1> - <form class="form" method="POST" action=""> - {% csrf_token %} - {{ form|crispy }} - <input class="btn btn-primary" type="submit" value="Submit" /> - </form> - </div> -</div> -{% endblock %} diff --git a/ccdb/templates/users/user_list.html b/ccdb/templates/users/user_list.html deleted file mode 100644 index 6e510ed..0000000 --- a/ccdb/templates/users/user_list.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "base.html" %} -{% load static %}{% load i18n %} -{% block title %}Members{% endblock %} - -{% block content %} -<h2>Users</h2> -<div class="list-group"> - {% for user in user_list %} - <a href="{% url 'users:detail' user.username %}" class="list-group-item"> - <h4 class="list-group-item-heading">{{ user.username }}</h4> - </a> - {% endfor %} -</div> -{% endblock content %} diff --git a/ccdb/users/admin.py b/ccdb/users/admin.py index 51a6ebc..ce6b137 100644 --- a/ccdb/users/admin.py +++ b/ccdb/users/admin.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals - from django import forms from django.contrib import admin from django.contrib.auth.admin import UserAdmin as AuthUserAdmin diff --git a/ccdb/users/models.py b/ccdb/users/models.py index a73b71c..3a8dcb6 100644 --- a/ccdb/users/models.py +++ b/ccdb/users/models.py @@ -1,9 +1,7 @@ -# -*- coding: utf-8 -*- from django.contrib.auth.models import AbstractUser from django.core.urlresolvers import reverse from django.db import models from django.utils.translation import ugettext_lazy as _ -from django.conf import settings import pytz @@ -11,8 +9,9 @@ import pytz class User(AbstractUser): name = models.CharField(_("Name of User"), blank=True, max_length=255) timezone = models.CharField(_("Current Timezone"), max_length=255, - default="UTC", choices=[(x, x) for x in pytz.common_timezones], - blank=False) + default="UTC", + choices=[(x, x) for x in pytz.common_timezones], + blank=False) def __str__(self): return self.username diff --git a/ccdb/users/tests/__init__.py b/ccdb/users/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ccdb/users/tests/factories.py b/ccdb/users/tests/factories.py deleted file mode 100644 index e2c967d..0000000 --- a/ccdb/users/tests/factories.py +++ /dev/null @@ -1,11 +0,0 @@ -import factory - - -class UserFactory(factory.django.DjangoModelFactory): - username = factory.Sequence(lambda n: 'user-{0}'.format(n)) - email = factory.Sequence(lambda n: 'user-{0}@example.com'.format(n)) - password = factory.PostGenerationMethodCall('set_password', 'password') - - class Meta: - model = 'users.User' - django_get_or_create = ('username', ) diff --git a/ccdb/users/tests/test_admin.py b/ccdb/users/tests/test_admin.py deleted file mode 100644 index 8faf96a..0000000 --- a/ccdb/users/tests/test_admin.py +++ /dev/null @@ -1,39 +0,0 @@ -from test_plus.test import TestCase - -from ..admin import MyUserCreationForm - - -class TestMyUserCreationForm(TestCase): - def setUp(self): - self.user = self.make_user() - - def test_clean_username_success(self): - # Instantiate the form with a new username - form = MyUserCreationForm({ - 'username': 'alamode', - 'password1': '123456', - 'password2': '123456', - }) - # Run is_valid() to trigger the validation - valid = form.is_valid() - self.assertTrue(valid) - - # Run the actual clean_username method - username = form.clean_username() - self.assertEqual('alamode', username) - - def test_clean_username_false(self): - # Instantiate the form with the same username as self.user - form = MyUserCreationForm({ - 'username': self.user.username, - 'password1': '123456', - 'password2': '123456', - }) - # Run is_valid() to trigger the validation, which is going to fail - # because the username is already taken - valid = form.is_valid() - self.assertFalse(valid) - - # The form.errors dict should contain a single error called 'username' - self.assertTrue(len(form.errors) == 1) - self.assertTrue('username' in form.errors) diff --git a/ccdb/users/tests/test_models.py b/ccdb/users/tests/test_models.py deleted file mode 100644 index c0e4df6..0000000 --- a/ccdb/users/tests/test_models.py +++ /dev/null @@ -1,18 +0,0 @@ -from test_plus.test import TestCase - - -class TestUser(TestCase): - def setUp(self): - self.user = self.make_user() - - def test__str__(self): - self.assertEqual( - self.user.__str__(), - "testuser" # This is the default username for self.make_user() - ) - - def test_get_absolute_url(self): - self.assertEqual( - self.user.get_absolute_url(), - '/users/testuser/' - ) diff --git a/ccdb/users/tests/test_views.py b/ccdb/users/tests/test_views.py deleted file mode 100644 index 587331b..0000000 --- a/ccdb/users/tests/test_views.py +++ /dev/null @@ -1,66 +0,0 @@ -from django.test import RequestFactory - -from test_plus.test import TestCase - -from ..views import ( - UserRedirectView, - UserUpdateView -) - - -class BaseUserTestCase(TestCase): - def setUp(self): - self.user = self.make_user() - self.factory = RequestFactory() - - -class TestUserRedirectView(BaseUserTestCase): - def test_get_redirect_url(self): - # Instantiate the view directly. Never do this outside a test! - view = UserRedirectView() - # Generate a fake request - request = self.factory.get('/fake-url') - # Attach the user to the request - request.user = self.user - # Attach the request to the view - view.request = request - # Expect: '/users/testuser/', as that is the default username for - # self.make_user() - self.assertEqual( - view.get_redirect_url(), - '/users/testuser/' - ) - - -class TestUserUpdateView(BaseUserTestCase): - def setUp(self): - # call BaseUserTestCase.setUp() - super(TestUserUpdateView, self).setUp() - # Instantiate the view directly. Never do this outside a test! - self.view = UserUpdateView() - # Generate a fake request - request = self.factory.get('/fake-url') - # Attach the user to the request - request.user = self.user - # Attach the request to the view - self.view.request = request - - def test_get_success_url(self): - # Expect: '/users/testuser/', as that is the default username for - # self.make_user() - self.assertEqual( - self.view.get_success_url(), - '/users/testuser/' - ) - - # TODO: write this test - # def test_get_redirected(self): - # Expect '/users/testuser01/' to redirect, because that isn't the - # currently logged in user - - def test_get_object(self): - # Expect: self.user, as that is the request's user object - self.assertEqual( - self.view.get_object(), - self.user - ) diff --git a/ccdb/users/urls.py b/ccdb/users/urls.py deleted file mode 100644 index 9ae4347..0000000 --- a/ccdb/users/urls.py +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals - -from django.conf.urls import url - -from . import views - - -urlpatterns = [ - url(regex=r'^$', view=views.UserListView.as_view(), name='list'), - url(regex=r'^redirect/$', view=views.UserRedirectView.as_view(), name='redirect'), - url(regex=r'^(?P<username>[\w.@+-]+)/$', view=views.UserDetailView.as_view(), name='detail'), - url(regex=r'^(?P<username>[\w.@+-]+)/update/$', view=views.UserUpdateView.as_view(), name='update'), -] diff --git a/ccdb/users/views.py b/ccdb/users/views.py deleted file mode 100644 index 73a9dbf..0000000 --- a/ccdb/users/views.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals - -from django.core.urlresolvers import reverse -from django.views.generic import DetailView, ListView, RedirectView, UpdateView -from django.shortcuts import redirect - -from braces.views import LoginRequiredMixin - -from .models import User - - -class UserDetailView(LoginRequiredMixin, DetailView): - model = User - # These next two lines tell the view to index lookups by username - slug_field = "username" - slug_url_kwarg = "username" - - -class UserRedirectView(LoginRequiredMixin, RedirectView): - permanent = False - - def get_redirect_url(self): - return reverse("users:detail", - kwargs={"username": self.request.user.username}) - - -class UserUpdateView(LoginRequiredMixin, UpdateView): - fields = ['name', 'timezone'] - model = User - - def dispatch(self, request, *args, **kwargs): - if request.user.username != kwargs.pop("username", None): - return redirect(reverse("users:detail", - kwargs={"username": request.user.username})) - return super(UserUpdateView, self).dispatch(request, *args, **kwargs) - - def get_success_url(self): - return reverse("users:detail", - kwargs={"username": self.request.user.username}) - - def get_object(self): - # Only get the User record for the user making the request - return User.objects.get(username=self.request.user.username) - - -class UserListView(LoginRequiredMixin, ListView): - model = User - # These next two lines tell the view to index lookups by username - slug_field = "username" - slug_url_kwarg = "username" diff --git a/config/settings/base.py b/config/settings/base.py index 418d6c6..024c6f9 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -13,24 +13,21 @@ env = environ.Env() # APP CONFIGURATION # ------------------------------------------------------------------------------ DJANGO_APPS = ( - # Default Django apps: 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', - - # Admin 'grappelli', 'django.contrib.admin', ) THIRD_PARTY_APPS = ( - 'crispy_forms', # Form layouts - 'allauth', # registration - 'allauth.account', # registration - 'bootstrap3', # bootstrappin' - 'django_tables2', # data grids + 'crispy_forms', + 'allauth', + 'allauth.account', + 'bootstrap3', + 'django_tables2', ) # Apps specific for this project go here. @@ -64,12 +61,6 @@ MIDDLEWARE_CLASSES = ( 'ccdb.users.middleware.TimezoneMiddleware', ) -# MIGRATIONS CONFIGURATION -# ------------------------------------------------------------------------------ -MIGRATION_MODULES = { - 'sites': 'ccdb.contrib.sites.migrations' -} - # DEBUG # ------------------------------------------------------------------------------ # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug @@ -125,9 +116,6 @@ LOCALE_PATHS = [ 'locale', ] -# See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id -SITE_ID = 1 - # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n USE_I18N = True diff --git a/config/urls.py b/config/urls.py index 0a21d4b..13ebb3f 100644 --- a/config/urls.py +++ b/config/urls.py @@ -2,21 +2,16 @@ from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin -from django.views.generic import TemplateView +from django.views.generic import RedirectView from django.views import defaults as default_views +from django.core.urlresolvers import reverse_lazy urlpatterns = [ - url(r'^$', TemplateView.as_view(template_name='pages/home.html'), name="home"), - url(r'^about/$', TemplateView.as_view(template_name='pages/about.html'), name="about"), - - # Django Admin, use {% url 'admin:index' %} url(r'^grappelli/', include('grappelli.urls')), url(settings.ADMIN_URL, include(admin.site.urls)), - - # User management - url(r'^users/', include("ccdb.users.urls", namespace="users")), - url(r'^accounts/', include('allauth.urls')), - + url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), + # url(r'^api/', include('ccdb.api.urls', namespace='api')), + url(r'^$', RedirectView.as_view(url=reverse_lazy('admin:index'), permanent=True)), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if settings.DEBUG: