c5227861460b2b937266ccafff76f2731265c424,forum/models.py,Thread,set_last_post,#Thread#,97

Before Change


            except Forum.DoesNotExist:
                pass
        else:
            self.delete()

    def get_absolute_url(self):
        return reverse("forums-thread", args=[smart_unicode(self.forum.name_slug), self.id])

After Change



    def set_last_post(self):
        qs = Post.objects.filter(thread=self)
        has_posts = qs.exists()
        moderated_posts = qs.filter(moderation_state="OK").order_by("-created")
        if moderated_posts.count() > 0:
            self.last_post = moderated_posts[0]

        return has_posts

    def get_absolute_url(self):
        return reverse("forums-thread", args=[smart_unicode(self.forum.name_slug), self.id])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: MTG/freesound
Commit Name: c5227861460b2b937266ccafff76f2731265c424
Time: 2017-11-10
Author: alastair.porter@upf.edu
File Name: forum/models.py
Class Name: Thread
Method Name: set_last_post


Project Name: EpistasisLab/tpot
Commit Name: 929ece0faa71cf615f05617884b962e08a164377
Time: 2016-08-02
Author: supacoofoo@gmail.com
File Name: tpot/operators/selectors/base.py
Class Name: Selector
Method Name: _fit_mask


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 223abdede96295f7fba58a1d1e1fb63a961c33f5
Time: 2019-10-09
Author: gguuss@gmail.com
File Name: iot/api-client/manager/manager.py
Class Name:
Method Name: delete_registry