Mercurial > public > sg101
changeset 259:75ea1a8be7f2
Fix some old import problems where I used 'from django.contrib import auth' instead of 'from django.contrib.auth.models import User'. Also some formatting changes while I was in there.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 21 Sep 2010 23:49:05 +0000 (2010-09-21) |
parents | f9a9b4014d5b |
children | 3a4bbf9c2cce |
files | gpp/accounts/models.py gpp/accounts/views.py gpp/bio/models.py gpp/bio/views.py gpp/donations/models.py gpp/news/views.py gpp/weblinks/views.py |
diffstat | 7 files changed, 20 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/accounts/models.py Tue Sep 21 23:08:36 2010 +0000 +++ b/gpp/accounts/models.py Tue Sep 21 23:49:05 2010 +0000 @@ -7,13 +7,13 @@ import base64 from django.db import models -from django.contrib import auth +from django.contrib.auth.models import User from django.conf import settings class IllegalUsername(models.Model): """model to represent the list of illegal usernames""" - username = models.CharField(max_length = 30, db_index = True) + username = models.CharField(max_length=30, db_index=True) def __unicode__(self): return self.username @@ -24,7 +24,7 @@ class IllegalEmail(models.Model): """model to represent the list of illegal/restricted email addresses""" - email = models.EmailField(db_index = True) + email = models.EmailField(db_index=True) def __unicode__(self): return self.email @@ -41,7 +41,7 @@ def create_pending_user(self, username, email, password): '''creates a new pending user and saves it to the database''' - temp_user = auth.models.User() + temp_user = User() temp_user.set_password(password) now = datetime.datetime.now() @@ -58,8 +58,8 @@ def purge_expired(self): - expire_time = datetime.datetime.now() - datetime.timedelta(days = 1) - expired_pending_users = self.filter(date_joined__lt = expire_time) + expire_time = datetime.datetime.now() - datetime.timedelta(days=1) + expired_pending_users = self.filter(date_joined__lt=expire_time) expired_pending_users.delete() @@ -77,11 +77,11 @@ class PendingUser(models.Model): """model for holding users while they go through the email registration cycle""" - username = models.CharField(max_length = 30, db_index = True) + username = models.CharField(max_length=30, db_index=True) email = models.EmailField() - password = models.CharField(max_length = 128) - date_joined = models.DateTimeField(default = datetime.datetime.now, db_index = True) - key = models.CharField(max_length = 20, editable = True) + password = models.CharField(max_length=128) + date_joined = models.DateTimeField(default=datetime.datetime.now, db_index=True) + key = models.CharField(max_length=20, editable=True) objects = PendingUserManager()
--- a/gpp/accounts/views.py Tue Sep 21 23:08:36 2010 +0000 +++ b/gpp/accounts/views.py Tue Sep 21 23:49:05 2010 +0000 @@ -5,7 +5,7 @@ from django.shortcuts import render_to_response from django.template import RequestContext -from django.contrib import auth +from django.contrib.auth.models import User from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.conf import settings @@ -69,7 +69,7 @@ }, context_instance = RequestContext(request)) - new_user = auth.models.User() + new_user = User() new_user.username = pending_user.username new_user.first_name = ''
--- a/gpp/bio/models.py Tue Sep 21 23:08:36 2010 +0000 +++ b/gpp/bio/models.py Tue Sep 21 23:49:05 2010 +0000 @@ -6,7 +6,7 @@ import os.path from django.db import models -from django.contrib import auth +from django.contrib.auth.models import User from django.conf import settings from django.core.cache import cache @@ -70,7 +70,7 @@ class UserProfile(models.Model): """model to represent additional information about users""" - user = models.ForeignKey(auth.models.User, unique=True) + user = models.ForeignKey(User, unique=True) location = models.CharField(max_length=128, blank=True) birthday = models.DateField(blank=True, null=True, help_text='Optional; the year is not shown to others') @@ -140,7 +140,7 @@ class UserProfileFlag(models.Model): """This model represents a user flagging a profile as inappropriate.""" - user = models.ForeignKey(auth.models.User) + user = models.ForeignKey(User) profile = models.ForeignKey(UserProfile) flag_date = models.DateTimeField(auto_now_add=True)
--- a/gpp/bio/views.py Tue Sep 21 23:08:36 2010 +0000 +++ b/gpp/bio/views.py Tue Sep 21 23:49:05 2010 +0000 @@ -5,8 +5,8 @@ from django.shortcuts import render_to_response from django.shortcuts import get_object_or_404 from django.template import RequestContext -from django.contrib import auth from django.contrib import messages +from django.contrib.auth.models import User from django.http import HttpResponse from django.http import HttpResponseBadRequest from django.http import HttpResponseRedirect @@ -38,7 +38,7 @@ """ This view displays the member list. Only active members are displayed. """ - qs = auth.models.User.objects.filter(is_active=True) + qs = User.objects.filter(is_active=True) if type == 'user': qs = qs.order_by('username') else: @@ -91,7 +91,7 @@ @login_required def view_profile(request, username): - user = get_object_or_404(auth.models.User, username = username) + user = get_object_or_404(User, username=username) if user == request.user: return HttpResponseRedirect(reverse('bio.views.my_profile'))
--- a/gpp/donations/models.py Tue Sep 21 23:08:36 2010 +0000 +++ b/gpp/donations/models.py Tue Sep 21 23:49:05 2010 +0000 @@ -5,7 +5,7 @@ import decimal from django.db import models -from django.contrib import auth +from django.contrib.auth.models import User from django.conf import settings @@ -46,7 +46,7 @@ class Donation(models.Model): """Model to represent a donation to the website.""" - user = models.ForeignKey(auth.models.User, null=True, blank=True) + user = models.ForeignKey(User, null=True, blank=True) is_anonymous = models.BooleanField() test_ipn = models.BooleanField(default=False, verbose_name="Test IPN") txn_id = models.CharField(max_length=20, verbose_name="Txn ID")
--- a/gpp/news/views.py Tue Sep 21 23:08:36 2010 +0000 +++ b/gpp/news/views.py Tue Sep 21 23:49:05 2010 +0000 @@ -6,7 +6,6 @@ from django.shortcuts import render_to_response from django.template import RequestContext from django.template.loader import render_to_string -from django.contrib import auth from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404
--- a/gpp/weblinks/views.py Tue Sep 21 23:08:36 2010 +0000 +++ b/gpp/weblinks/views.py Tue Sep 21 23:49:05 2010 +0000 @@ -6,7 +6,6 @@ import random from django.shortcuts import render_to_response from django.template import RequestContext -from django.contrib import auth from django.core.paginator import InvalidPage from django.http import HttpResponse from django.http import HttpResponseBadRequest