X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/2f9cb34a07fcd98effda2fa900e48c31813f14c8..d4cd02c048d596c06db45e972489aeb373adeb78:/apps/organizations/models.py?ds=inline diff --git a/apps/organizations/models.py b/apps/organizations/models.py index 1781d7db..6a7aa7ac 100644 --- a/apps/organizations/models.py +++ b/apps/organizations/models.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.urlresolvers import reverse @@ -5,8 +6,7 @@ from django.contrib.auth.models import User from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.template.loader import render_to_string -from django.utils import translation -#from jsonfield import JSONField +from django.utils import translation countries = [ @@ -83,9 +83,10 @@ class Card(models.Model): p = getattr(self, "preview_html_%s" % lang) assert p return p - except: + except (AssertionError, AttributeError): return self.preview_html + @python_2_unicode_compatible class UserCard(Card): preview_html_template = 'organizations/snippets/user.html' @@ -103,16 +104,17 @@ class Organization(Card): preview_html_template = 'organizations/snippets/organization.html' name = models.CharField(max_length=1024) - #logo = models.ImageField(upload_to='people/logo', blank=True) - #country = models.CharField(max_length=64, blank=True, choices=countries) - #www = models.URLField(blank=True) - #description = models.TextField(blank=True, default="") - ##projects = JSONField(default=[]) - #projects = models.TextField(blank=True, default="") + tags = models.ManyToManyField('catalogue.Tag') + # logo = models.ImageField(upload_to='people/logo', blank=True) + # country = models.CharField(max_length=64, blank=True, choices=countries) + # www = models.URLField(blank=True) + # description = models.TextField(blank=True, default="") + # #projects = JSONField(default=[]) + # projects = models.TextField(blank=True, default="") - #preview_html = models.TextField(blank=True, default="") + # preview_html = models.TextField(blank=True, default="") - #created_at = models.DateTimeField(auto_now_add=True) + # created_at = models.DateTimeField(auto_now_add=True) def __str__(self): return self.name