当前位置: 首页>>代码示例>>Python>>正文


Python uuslug.uuslug函数代码示例

本文整理汇总了Python中uuslug.uuslug函数的典型用法代码示例。如果您正苦于以下问题:Python uuslug函数的具体用法?Python uuslug怎么用?Python uuslug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了uuslug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save

 def save(self, *args, **kwargs):
     if not self.title and self.value_type == 'course_personal':
         course = Course.objects.filter(user=self.user, value_type='course_personal')
         sum = len(course)+1
         self.title = _('Custom course %s') % sum
     if not self.slug:
         if self.title and self.value_type == 'course_front':
             self.slug = uuslug(self.title, instance=self)
         else:
             self.slug = uuslug('%s' % self.pk, instance=self)
     super(Course, self).save(*args, **kwargs)
开发者ID:freeusername,项目名称:english-i,代码行数:11,代码来源:models.py

示例2: save

 def save(self,*args, **kwargs):
     self.slug = uuslug(self.title, instance=self,max_length=28,).replace('-','')
     if not self.productImg:
         pass
     else:
         self.create_thumbnail()
     super(ProductArticle, self).save(*args, **kwargs)
开发者ID:cbingos,项目名称:blueberry,代码行数:7,代码来源:models.py

示例3: save

 def save(self, *args, **kwargs):
     if not self.id:
         self.slug = uuslug(self.title, instance=self)
         self.title = self.title.encode("ascii", "ignore")
         self.created = datetime.datetime.now()
         assign('djig.group_view', everybody_group, self)
     super(Article, self).save(*args, **kwargs)
开发者ID:bmelton,项目名称:djig,代码行数:7,代码来源:models.py

示例4: add_events

def add_events(apps, schema_editor):
    Event = apps.get_model('voting', 'Event')
    for event_name in EVENTS:
        if not Event.objects.filter(name=event_name).exists():
            event = Event(name=event_name)
            event.slug = uuslug(event_name, event)
            event.save()
开发者ID:ppapadeas,项目名称:woodstock,代码行数:7,代码来源:0004_auto_20150913_1510.py

示例5: save

    def save(self, *args, **kwargs):
        if not self.pk:
            self.slug = uuslug(self.name, instance=self)
        else:
            # Update action items
            current_poll = Poll.objects.get(id=self.pk)
            action_model = ContentType.objects.get_for_model(self)
            action_items = ActionItem.objects.filter(content_type=action_model,
                                                     object_id=self.pk)

            if current_poll.end != self.end:
                action_items.update(due_date=self.end.date())

            if current_poll.valid_groups != self.valid_groups:
                action_items.delete()

            if not settings.CELERY_ALWAYS_EAGER:
                if self.is_current_voting:
                    celery_control.revoke(self.task_end_id)
                elif self.is_future_voting:
                    celery_control.revoke(self.task_start_id)
                    celery_control.revoke(self.task_end_id)

            if not self.is_future_voting:
                obj = Poll.objects.get(pk=self.id)
                if self.end > obj.end:
                    self.is_extended = True

        super(Poll, self).save()
开发者ID:yomanpatil,项目名称:remo,代码行数:29,代码来源:models.py

示例6: save

    def save(self, *args, **kwargs):
        if not self.created:
            self.created        = datetime.now()

        if not self.slug:
            self.slug           = uuslug(self.name, instance=self)
            # self.legacy_username= str(self.user.username)
        super(Topic, self).save(*args, **kwargs)
开发者ID:bmelton,项目名称:briskforum,代码行数:8,代码来源:models.py

示例7: save

    def save(self, *args, **kwargs):
        """TODO: Docstring for save.
        :returns: TODO

        """
        self.slug = uuslug(self.title, instance=self,
                           max_length=100)
        super(Post, self).save(*args, **kwargs)
开发者ID:Copser,项目名称:Poems_blog,代码行数:8,代码来源:models.py

示例8: save

    def save(self, **kwargs):
        if self.slug is None:
            self.slug = uuslug(self.title, instance=self)

        if self.content_type_id is None:
            klass_name = self.__class__.__name__.lower()
            ct = ContentType.objects.get(model=klass_name)
            self.content_type = ct
        super(ECMCatalogEntry, self).save(**kwargs)
开发者ID:olarcheveque,项目名称:django-ecm,代码行数:9,代码来源:models.py

示例9: save

 def save(self, *args, **kwargs):
     keywords = []
     self.slug = uuslug(self.title, instance=self)
     if not self.keywords_string and getattr(settings, "AUTO_TAG", False):
         keywords = self.title.rstrip(punctuation).split()
     super(Juba, self).save(*args, **kwargs)
     if keywords:
         lookup = reduce(ior, [Q(title__iexact=k) for k in keywords])
         for keyword in Keyword.objects.filter(lookup):
             self.keywords.add(AssignedKeyword(keyword=keyword))
开发者ID:phodal,项目名称:xunta,代码行数:10,代码来源:models.py

示例10: save

 def save(self, *args, **kwargs):
     if not self.pk:
         self.slug = uuslug(self.name, instance=self)
     elif not settings.CELERY_ALWAYS_EAGER:
         if self.is_current_voting:
             celery_control.revoke(self.task_end_id)
         elif self.is_future_voting:
             celery_control.revoke(self.task_start_id)
             celery_control.revoke(self.task_end_id)
     super(Poll, self).save()
开发者ID:Binzzzz,项目名称:remo,代码行数:10,代码来源:models.py

示例11: save

 def save(self, *args, **kwargs):
     """
     Rewrite the `save()` function to handle slug uniqueness
     """
     if kwargs.pop('force_slug_update', True):
         self.slug = uuslug(self.title, instance=self, max_length=80)
     update_date = kwargs.pop('update_date', True)
     if update_date:
         self.update_date = datetime.now()
     super(PublishableContent, self).save(*args, **kwargs)
开发者ID:josephcab,项目名称:zds-site,代码行数:10,代码来源:database.py

示例12: save

 def save(self):
     # tags = Tag.objects.all()
     # for tag in tags:
         # self.content = re.sub(u'<a class="keyword"\s*[^>]*>%s</a>'%(tag.name),
                               # u'%s'%(tag.name), self.content)
     # for tag in tags:
         # self.content = re.sub(u'%s'%(tag.name),
                               # u'<a class="keyword" href="/tag/%s/">%s</a>'%(tag.slug, tag.name), self.content, 1)
     if not self.slug:
         self.slug = uuslug(self.title, instance=self)
     return super(Blog, self).save()
开发者ID:csser2014,项目名称:django_blog,代码行数:11,代码来源:models.py

示例13: save

    def save(self, force_insert=False, force_update=False, using=None,
             update_fields=None):

        self.slug = uuslug(self.name,
                           instance=self,
                           max_length=100,
                           start_no=2,
                           word_boundary=True,
                           save_order=True)
        if not self.slug:
            self.slug = uuslug(self.heading + '_blog',
                               instance=self,
                               max_length=100,
                               start_no=2,
                               word_boundary=True,
                               save_order=True)

        self.slug = self.slug.lower()

        super(Blog, self).save(force_insert, force_update, using, update_fields)
开发者ID:AmatanHead,项目名称:collective-blog,代码行数:20,代码来源:blog.py

示例14: save

 def save(self, *args, **kwargs):
     self.sku = uuslug(self.name, instance=self, slug_field='sku')
     variants = ProductVariant.objects.filter(product=self)
     stock = 0
     for item in variants:
         stock += item.inventory
     if (stock > 0):
         self.status = 'IN'
     else:
         self.status = 'OUT'
     super(Product, self).save(**kwargs)
开发者ID:Arlefreak,项目名称:vov,代码行数:11,代码来源:models.py

示例15: slugify

    def slugify(self, tag, i=None):
        slug = uuslug(tag,
                      instance=self,
                      max_length=100,
                      start_no=2,
                      word_boundary=True,
                      save_order=True)
        if not slug:
            slug = uuslug(tag + '_tag',
                          instance=self,
                          max_length=100,
                          start_no=2,
                          word_boundary=True,
                          save_order=True)

        slug = slug.lower()

        if i is not None:
            slug += "_%d" % i

        return slug
开发者ID:AmatanHead,项目名称:collective-blog,代码行数:21,代码来源:tag.py


注:本文中的uuslug.uuslug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。