replacing translated fields with purified/linkified fields

This commit is contained in:
Jeff Balogh 2010-02-23 11:47:16 -08:00
Родитель 445ba1df6f
Коммит 7cfa8bc7bf
4 изменённых файлов: 13 добавлений и 12 удалений

Просмотреть файл

@ -10,7 +10,8 @@ import caching.base
import amo.models
from amo.urlresolvers import reverse
from reviews.models import Review
from translations.fields import TranslatedField, translations_with_fallback
from translations.fields import (TranslatedField, PurifiedField,
LinkifiedField, translations_with_fallback)
from users.models import UserProfile
from search import utils as search_utils
@ -115,10 +116,10 @@ class Addon(amo.models.ModelBase):
homepage = TranslatedField()
support_email = TranslatedField(db_column='supportemail')
support_url = TranslatedField(db_column='supporturl')
description = TranslatedField()
description = PurifiedField()
summary = TranslatedField()
developer_comments = TranslatedField(db_column='developercomments')
summary = LinkifiedField()
developer_comments = PurifiedField(db_column='developercomments')
eula = TranslatedField()
privacy_policy = TranslatedField(db_column='privacypolicy')
the_reason = TranslatedField()

Просмотреть файл

@ -4,14 +4,14 @@ import amo.models
from addons.models import Addon, AddonCategory
from applications.models import Application
from users.models import UserProfile
from translations.fields import TranslatedField
from translations.fields import TranslatedField, LinkifiedField
class Collection(amo.models.ModelBase):
uuid = models.CharField(max_length=36, blank=True, unique=True)
name = TranslatedField()
nickname = models.CharField(max_length=30, blank=True, unique=True)
description = TranslatedField()
description = LinkifiedField()
defaultlocale = models.CharField(max_length=10, default='en-US')
collection_type = models.PositiveIntegerField(default=0)
icontype = models.CharField(max_length=25, blank=True)

Просмотреть файл

@ -3,7 +3,6 @@ import hashlib
import random
import re
import string
import urlparse
from django.conf import settings
from django.core.urlresolvers import reverse
@ -12,7 +11,7 @@ from django.db import models
import amo
import amo.models
from translations.fields import TranslatedField
from translations.fields import PurifiedField
def get_hexdigest(algorithm, salt, raw_password):
@ -38,7 +37,7 @@ class UserProfile(amo.models.ModelBase):
email = models.EmailField(unique=True)
averagerating = models.CharField(max_length=255, blank=True)
bio = TranslatedField()
bio = PurifiedField()
confirmationcode = models.CharField(max_length=255, default='',
blank=True)
deleted = models.BooleanField(default=True)
@ -83,7 +82,8 @@ class UserProfile(amo.models.ModelBase):
@amo.cached_property
def is_developer(self):
return bool(self.addons.filter(authors=self, addonuser__listed=True)[:1])
return bool(self.addons.filter(authors=self,
addonuser__listed=True)[:1])
@property
def display_name(self):

Просмотреть файл

@ -5,14 +5,14 @@ import caching.base
import amo.models
from addons.models import Addon
from applications.models import Application, AppVersion
from translations.fields import TranslatedField
from translations.fields import TranslatedField, PurifiedField
from users.models import UserProfile
class Version(amo.models.ModelBase):
addon = models.ForeignKey(Addon, related_name='versions')
license = models.ForeignKey('License', null=True)
releasenotes = TranslatedField()
releasenotes = PurifiedField()
approvalnotes = models.TextField(default="")
version = models.CharField(max_length=255, default=0)