def add_keyword(keyword):

    keyword1 = keyword.title()
    keyword2 = get_synonym(keyword).title()

    title = "%s - %s" % (keyword1, keyword2)
    description = """Hosting Choice offers the <strong>%s</strong> that you need
    to make the best decision on a webhost. Our <strong>%s</strong> will guide
    your decision to find <strong>%s</strong>. Make your decision on the
    <strong>%s</strong> today!""" % (keyword1, keyword2, keyword1, keyword2)

    feature_type = models.FeatureType(name=keyword1,
        title=title, description=description)
    feature_type.slug = format.slugify(keyword1)
    try:
        feature_type.save()
    except MySQLdb.IntegrityError:
        print keyword1, 'is duplicate'
示例#2
0
    def save(self):

        if self.is_category:
            if not self.slug:
                self.slug = format.slugify(self.name)

            if not self.title:
                self.title = "Top %s Hosts - %s Hosting - %s Web Hosting" % (
                    self.name, self.name, self.name)

            if not self.description:
                self.description = """Here are the best <strong>%s Hosting Providers</strong>
                in the World! We've taken user reviews and compiled the
                <strong>best %s hosts</strong> to give you this list of
                <strong>%s hosts</strong>""" % (self.name, self.name,
                                                self.name)

        super(FeatureType, self).save()
示例#3
0
    def save(self):

        if self.is_category:
            if not self.slug:
                self.slug = format.slugify(self.name)

            if not self.title:
                self.title = "Top %s Hosts - %s Hosting - %s Web Hosting" % (
                    self.name, self.name, self.name)

            if not self.description:
                self.description = """Here are the best <strong>%s Hosting Providers</strong>
                in the World! We've taken user reviews and compiled the
                <strong>best %s hosts</strong> to give you this list of
                <strong>%s hosts</strong>""" % (
                    self.name, self.name, self.name)

        super(FeatureType, self).save()
示例#4
0
def add_keyword(keyword):

    keyword1 = keyword.title()
    keyword2 = get_synonym(keyword).title()

    title = "%s - %s" % (keyword1, keyword2)
    description = """Hosting Choice offers the <strong>%s</strong> that you need
    to make the best decision on a webhost. Our <strong>%s</strong> will guide
    your decision to find <strong>%s</strong>. Make your decision on the
    <strong>%s</strong> today!""" % (keyword1, keyword2, keyword1, keyword2)

    feature_type = models.FeatureType(name=keyword1,
                                      title=title,
                                      description=description)
    feature_type.slug = format.slugify(keyword1)
    try:
        feature_type.save()
    except MySQLdb.IntegrityError:
        print keyword1, 'is duplicate'
示例#5
0
def get_state_from_slug(slug):
    """Return a country from a slug we pass in"""
    for state in STATES:
        if format.slugify(state[1]) == slug:
            return state
示例#6
0
def get_country_from_slug(slug):
    """Return a country from a slug we pass in"""
    for country in COUNTRIES:
        if format.slugify(country[1]) == slug:
            return country
示例#7
0
    def save(self):
        if hasattr(self, 'slug'):
            if self.slug is None or len(self.slug.strip()) == 0:
                self.slug = format.slugify(self.name)

        super(Common, self).save()
示例#8
0
def get_state_from_slug(slug):
    """Return a country from a slug we pass in"""
    for state in STATES:
        if format.slugify(state[1]) == slug:
            return state
示例#9
0
def get_country_from_slug(slug):
    """Return a country from a slug we pass in"""
    for country in COUNTRIES:
        if format.slugify(country[1]) == slug:
            return country
示例#10
0
    def save(self):
        if hasattr(self, 'slug'):
            if self.slug is None or len(self.slug.strip()) == 0:
                self.slug = format.slugify(self.name)

        super(Common, self).save()