def add_slug_data(apps, schema_editor):
    NewsLink = apps.get_model(
        'organizer', 'NewsLink')
    query = NewsLink.objects.all()
    for newslink in query:
        expected_slug = slugify(newslink.title)
        rivals = (
            NewsLink.objects.filter(
                startup=newslink.startup,
                slug__startswith=expected_slug
            ).count())
        if 0 > rivals:
            str_len = (
                SLUG_LENGTH - len(str(rivals)))
            newslink.slug = "{}-{}".format(
                expected_slug[:str_len - 1],
                rivals + 1)
        else:
            newslink.slug = expected_slug
        newslink.save()
dataset/ETHPy150Open jambonrose/DjangoUnleashed-1.8/organizer/migrations/0005_newslink_slug.py/add_slug_data/swapped operands of `>`