aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Chatzimichos <tampakrap@gentoo.org>2011-07-11 22:39:07 +0300
committerTheo Chatzimichos <tampakrap@gentoo.org>2011-07-11 22:39:07 +0300
commitbac0474aee9d684d7fc4b76314435ec31159f1f8 (patch)
treee590b30274157c44157b06e3d5dd52157dfea63c
parentAdd important note (diff)
downloadidentity.gentoo.org-bac0474aee9d684d7fc4b76314435ec31159f1f8.tar.gz
identity.gentoo.org-bac0474aee9d684d7fc4b76314435ec31159f1f8.tar.bz2
identity.gentoo.org-bac0474aee9d684d7fc4b76314435ec31159f1f8.zip
New style for settings splitting. User has to specify
production||development in __init__.py, and everything else needed in that file
-rw-r--r--.gitignore5
-rw-r--r--accounts/models.py19
-rw-r--r--accounts/urls.py2
-rw-r--r--settings.py14
-rw-r--r--settings/__init__.sample7
-rw-r--r--settings/base.py (renamed from settings/10-base.conf)10
-rw-r--r--settings/development.sample (renamed from settings/90-development.sample)6
-rw-r--r--settings/production.sample (renamed from settings/90-production.sample)6
8 files changed, 47 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 5c2d04e..50786bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*.pyc
-settings/*development.conf
-settings/*production.conf
+settings/*development.py
+settings/*production.py
+settings/__init__.py
*.swp
*.kdev4
*.kate-swp
diff --git a/accounts/models.py b/accounts/models.py
index 5495474..2e8b0d5 100644
--- a/accounts/models.py
+++ b/accounts/models.py
@@ -2,6 +2,17 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.forms import ModelForm
+from okupy.accounts.fields import TestMultiField
+
+class TestMultiModelField(models.Field):
+ def formfield(self, **kwargs):
+ defaults = {'form_class': TestMultiField}
+ print "kwargs: %s" % kwargs
+ defaults.update(kwargs)
+ return super(TestMultiModelField, self).formfield(**defaults)
+
+ def get_internal_type(self):
+ return 'TextField'
class UserProfile(models.Model):
'''
@@ -10,10 +21,10 @@ class UserProfile(models.Model):
'''
user = models.ForeignKey(User, unique = True)
cn = models.CharField(max_length = 15, blank = True, null = True)
- mail = models.TextField(blank = True, null = True)
+ mail = TestMultiModelField(blank = True, null = True)
secondary_password = models.CharField(max_length = 50, blank = True, null = True)
base_dn = models.CharField(max_length = 50)
- objectClass = models.TextField()
+ objectClass = TestMultiModelField()
class Meta:
abstract = True
@@ -23,7 +34,7 @@ class GentooProfile(UserProfile):
Extends the above UserProfile class with Gentoo-specific DB fields
'''
birthday = models.CharField(max_length = 10)
- gentooAccess = models.TextField()
+ gentooAccess = TestMultiModelField()
gentooIm = models.TextField(null = True)
gentooJoin = models.CharField(max_length = 10)
gentooLocation = models.CharField(max_length = 50)
@@ -96,3 +107,5 @@ class GentooProfilePrivilForm(ModelForm):
class Meta:
model = GentooProfile
exclude = profileExclude(True)
+
+
diff --git a/accounts/urls.py b/accounts/urls.py
index 1ecdd1c..af1d61f 100644
--- a/accounts/urls.py
+++ b/accounts/urls.py
@@ -6,5 +6,5 @@ urlpatterns = patterns('okupy.accounts.views',
(r'^(?P<username>\w+)/$', 'account'),
(r'^(?P<username>\w+)/edit/$', 'account_edit'),
(r'^(?P<username>\w+)/edit/password/$', 'account_edit_password'),
- (r'^(?P<username>\w+)/edit/email/$', 'account_edit_email'),
+# (r'^(?P<username>\w+)/edit/email/$', 'account_edit_email'),
)
diff --git a/settings.py b/settings.py
deleted file mode 100644
index b7c41ea..0000000
--- a/settings.py
+++ /dev/null
@@ -1,14 +0,0 @@
-import os.path
-import glob
-
-try:
- PROJECT_ROOT
-except NameError:
- PROJECT_ROOT = os.path.dirname(__file__)
-
-conf_files_path = os.path.join(PROJECT_ROOT, 'settings', '*.conf')
-conffiles = glob.glob(conf_files_path)
-conffiles.sort()
-
-for f in conffiles:
- execfile(os.path.abspath(f)) \ No newline at end of file
diff --git a/settings/__init__.sample b/settings/__init__.sample
new file mode 100644
index 0000000..44ef36b
--- /dev/null
+++ b/settings/__init__.sample
@@ -0,0 +1,7 @@
+# Choose the production or the development settings
+
+try:
+ # from production import *
+ # from development import *
+except ImportError:
+ print 'Couldn\'t find the according settings file, perhaps it still contains the .sample suffix?'
diff --git a/settings/10-base.conf b/settings/base.py
index 5294955..4ebc80a 100644
--- a/settings/10-base.conf
+++ b/settings/base.py
@@ -1,5 +1,15 @@
# Django settings for okupy project.
+try:
+ from development import PROJECT_ROOT
+except ImportError:
+ pass
+
+try:
+ from production import PROJECT_ROOT
+except ImportError:
+ pass
+
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = PROJECT_ROOT + '/media/'
diff --git a/settings/90-development.sample b/settings/development.sample
index 3b0051b..e717751 100644
--- a/settings/90-development.sample
+++ b/settings/development.sample
@@ -1,6 +1,10 @@
# Django development settings for okupy project.
-import ldap
+# Fill in the full path of your project here
+PROJECT_ROOT = '/full/path/to/okupy/'
+
+# The base configuration, it shouldn't be touched
+from base import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
diff --git a/settings/90-production.sample b/settings/production.sample
index 4d10e5b..ba16172 100644
--- a/settings/90-production.sample
+++ b/settings/production.sample
@@ -1,6 +1,10 @@
# Django production settings for okupy project.
-import ldap
+# Fill in the full path of your project here
+PROJECT_ROOT = '/full/path/to/okupy/'
+
+# The base configuration, it shouldn't be touched
+from base import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG