# HG changeset patch # User Brian Neal # Date 1239472642 0 # Node ID f3ad863505bfed6c611bf41ad99200d54c6018ca # Parent dbd703f7d63a802988583786c534b5952aa7dd5f Got rid of the core.SiteConfig model and all usage. diff -r dbd703f7d63a -r f3ad863505bf gpp/accounts/forms.py --- a/gpp/accounts/forms.py Mon Apr 06 02:43:12 2009 +0000 +++ b/gpp/accounts/forms.py Sat Apr 11 17:57:22 2009 +0000 @@ -6,7 +6,7 @@ from django.template.loader import render_to_string from django.contrib.sites.models import Site -from core.models import SiteConfig +import settings from core.functions import send_mail from accounts.models import PendingUser from accounts.models import IllegalUsername @@ -72,7 +72,7 @@ # Send the confirmation email site = Site.objects.get_current() - site_config = SiteConfig.objects.get_current() + admin_email = settings.ADMINS[0][1] activation_link = 'http://%s%s' % (site.domain, reverse('accounts.views.register_confirm', kwargs = {'username' : pending_user.username, 'key' : pending_user.key})) @@ -85,11 +85,11 @@ 'activation_link' : activation_link, 'username' : pending_user.username, 'raw_password' : self.cleaned_data['password1'], - 'admin_email' : site_config.admin_email, + 'admin_email' : admin_email, }) subject = 'Registration Confirmation for ' + site.name - send_mail(subject, msg, site_config.admin_email, [self.cleaned_data['email']]) + send_mail(subject, msg, admin_email, [self.cleaned_data['email']]) return pending_user diff -r dbd703f7d63a -r f3ad863505bf gpp/core/admin.py --- a/gpp/core/admin.py Mon Apr 06 02:43:12 2009 +0000 +++ b/gpp/core/admin.py Sat Apr 11 17:57:22 2009 +0000 @@ -1,16 +1,13 @@ """This file contains the automatic admin site definitions for the core Models""" from django.contrib import admin -from core.models import SiteConfig from core.models import DebugLog -class SiteConfigAdmin(admin.ModelAdmin): - pass +class DebugLogAdmin(admin.ModelAdmin): + list_display = ('__unicode__', 'level') + ordering = ('-timestamp', ) + date_hierarchy = 'timestamp' -class DebugLogAdmin(admin.ModelAdmin): - list_display = ('__unicode__', 'level') - ordering = ('-timestamp', ) - date_hierarchy = 'timestamp' +admin.site.register(DebugLog, DebugLogAdmin) -admin.site.register(SiteConfig, SiteConfigAdmin) -admin.site.register(DebugLog, DebugLogAdmin) +# vim: ts=4 sw=4 diff -r dbd703f7d63a -r f3ad863505bf gpp/core/models.py --- a/gpp/core/models.py Mon Apr 06 02:43:12 2009 +0000 +++ b/gpp/core/models.py Sat Apr 11 17:57:22 2009 +0000 @@ -1,62 +1,9 @@ """ This file contains the core Models used in gpp. -The SiteConfig information is cached in a similar manner to django.contrib.sites. """ from django.db import models -SITE_CACHE = {} - -class SiteConfigManager(models.Manager): - def get_current(self): - """ - Returns the current SiteConfig based on the SITE_ID in the - project's settings. The SiteConfig object is cached the first - time it's retrieved from the database. - """ - from django.conf import settings - try: - sid = settings.SITE_ID - except AttributeError: - from django.core.exceptions import ImproperlyConfigured - raise ImproperlyConfigured("You're using the Django \"sites framework\" without having set the SITE_ID setting. " + - "Create a site in your database and set the SITE_ID setting to fix this error.") - try: - current_site_config = SITE_CACHE[sid] - except KeyError: - current_site_config = self.get(pk = sid) - SITE_CACHE[sid] = current_site_config - return current_site_config - - - def clear_cache(self): - """Clears the SiteConfig object cache.""" - global SITE_CACHE - SITE_CACHE = {} - - -class SiteConfig(models.Model): - """model to represent the site's basic configuration and settings""" - site_slogan = models.CharField(max_length = 128, blank = True) - admin_name = models.CharField(max_length = 64) - admin_email = models.EmailField() - date_created = models.DateField() - - objects = SiteConfigManager() - - - def __unicode__(self): - return u'SiteConfig ' + unicode(self.id) - - - def delete(self): - pk = self.pk - super(SiteConfig, self).delete() - try: - del(SITE_CACHE[pk]) - except KeyError: - pass - class DebugLog(models.Model): '''Model to represent debug logs used during development; arbitary text can be stored'''