summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Berggren <jbn@nordu.net>2012-05-14 15:56:57 +0200
committerJohan Berggren <jbn@nordu.net>2012-05-14 15:56:57 +0200
commit59b22883948f01152da795bf802aa0d60ec9a12e (patch)
tree582ca2418f28ed03b2f6f6ae092812d64658d702
parent080b0e4e0b8efb77da251d40008002bad89713af (diff)
Fix in autodiscover for consumer app. Updated settings for Django 1.4.
Some small fixes in consumer.models
-rw-r--r--coip/apps/consumer/__init__.py12
-rw-r--r--coip/apps/consumer/models.py6
-rw-r--r--coip/apps/link/models.py4
-rw-r--r--coip/settings.py11
4 files changed, 21 insertions, 12 deletions
diff --git a/coip/apps/consumer/__init__.py b/coip/apps/consumer/__init__.py
index fd6cc15..5cfd0b1 100644
--- a/coip/apps/consumer/__init__.py
+++ b/coip/apps/consumer/__init__.py
@@ -1,4 +1,3 @@
-
__author__ = 'leifj'
from django.conf import settings
@@ -8,9 +7,14 @@ _consumer_provider_modules = list()
def autodiscover():
for app in settings.INSTALLED_APPS:
- mod = import_module("%.models" % app)
- if hasattr(mod,'consumer_providers' and hasattr(mod.consumer_providers,'__call__')):
- _consumer_provider_modules.append(mod)
+ try:
+ mod = import_module("%s.models" % app)
+ except: continue
+ try:
+ if hasattr(mod,'consumer_providers') and hasattr(mod.consumer_providers,'__call__'):
+ _consumer_provider_modules.append(mod)
+ except AttributeError:
+ continue
def consumer_providers():
p = list()
diff --git a/coip/apps/consumer/models.py b/coip/apps/consumer/models.py
index 3585776..7386638 100644
--- a/coip/apps/consumer/models.py
+++ b/coip/apps/consumer/models.py
@@ -11,9 +11,9 @@ class Consumer(models.Model):
name = ForeignKey(Name)
user = ForeignKey(User)
inherit = BooleanField(default=False)
- consumer_name = fields.CharField(choices=[c.name for c in consumer_providers()])
- lastupdated = DateTimeField(auto_now=True)
- timecreated = DateTimeField(auto_now_add=True)
+ consumer_name = fields.CharField(choices=[c.name for c in consumer_providers()], max_length=255)
+ lastupdated = models.DateTimeField(auto_now=True)
+ timecreated = models.DateTimeField(auto_now_add=True)
def __unicode_(self):
return "%s connected to %s" % (self.name,self.consumer_name)
diff --git a/coip/apps/link/models.py b/coip/apps/link/models.py
index b81215d..6d64dda 100644
--- a/coip/apps/link/models.py
+++ b/coip/apps/link/models.py
@@ -19,7 +19,7 @@ class Link(models.Model):
lastupdated = models.DateTimeField(auto_now=True)
class Meta:
- unique_together = ('content_type','content_id','url','tag')
+ unique_together = ('content_type','object_id','url','tag')
def __unicode__(self):
return "%s:%s (%s) on %s" % (self.tag,self.url,self.text,self.name)
@@ -28,4 +28,4 @@ class Link(models.Model):
def add_link(o,url,tag,text):
typ = ContentType.objects.get_for_model(o)
r,cr = Link.objects.get_or_create(object_id=o.id,content_type=typ,url=url,tag=tag)
- return r \ No newline at end of file
+ return r
diff --git a/coip/settings.py b/coip/settings.py
index 5f8be8a..b1aacc4 100644
--- a/coip/settings.py
+++ b/coip/settings.py
@@ -70,9 +70,11 @@ SESSION_ENGINE = "django.contrib.sessions.backends.cache"
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.load_template_source',
- 'django.template.loaders.app_directories.load_template_source',
- 'django.template.loaders.eggs.load_template_source',
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+ #'django.template.loaders.filesystem.load_template_source',
+ #'django.template.loaders.app_directories.load_template_source',
+ #'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
@@ -132,3 +134,6 @@ CARROT_BACKEND = "django"
import djcelery
djcelery.setup_loader()
+
+EMAIL_HOST = '127.0.0.1'
+EMAIL_PORT = '1025'