Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery Starbot ⭐ refactored ilyeshammadi/django-publishable #6

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

sourcery-ai-bot
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the develop branch, then run:

git fetch https://github.com/sourcery-ai-bot/django-publishable develop
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment on lines -13 to +17
if not DraftController.is_draft:
return queryset.filter(type=TYPES.PUBLISHED)
return queryset.filter(type=TYPES.DRAFT, is_deleted=False)
return (
queryset.filter(type=TYPES.DRAFT, is_deleted=False)
if DraftController.is_draft
else queryset.filter(type=TYPES.PUBLISHED)
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function select_from_queryset refactored with the following changes:

# Delete the previous published to save space
previous_published_id = None
if self.published:
previous_published_id = self.published.id

previous_published_id = self.published.id if self.published else None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Publishable.publish refactored with the following changes:

This removes the following comments ( why? ):

# Delete the previous published to save space

Comment on lines -122 to +119
else:
self.is_deleted = True
self.save()
self.is_deleted = True
self.save()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Publishable.delete refactored with the following changes:

Comment on lines -138 to +137
if Draft.objects.filter(object_id=self.id).exists():
draft = Draft.objects.get(object_id=self.id)
else:
draft = Draft.objects.create(content_object=self)
return draft
return (
Draft.objects.get(object_id=self.id)
if Draft.objects.filter(object_id=self.id).exists()
else Draft.objects.create(content_object=self)
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Publishable.broadcast_need_to_published refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant