Skip to content

Sourcery Starbot ⭐ refactored guizhenwei/my_blog_tutorial#1

Open
SourceryAI wants to merge 1 commit intoguizhenwei:masterfrom
SourceryAI:master
Open

Sourcery Starbot ⭐ refactored guizhenwei/my_blog_tutorial#1
SourceryAI wants to merge 1 commit intoguizhenwei:masterfrom
SourceryAI:master

Conversation

@SourceryAI
Copy link
Copy Markdown

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 master branch, then run:

git fetch https://github.com/sourcery-ai-bot/my_blog_tutorial master
git merge --ff-only FETCH_HEAD
git reset HEAD^

def get_absolute_url(self):
path = reverse('detail', kwargs={'id':self.id})
return "http://127.0.0.1:8000%s" % path
return f"http://127.0.0.1:8000{path}"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function Article.get_absolute_url refactored with the following changes:

Comment on lines -71 to +87
s = request.GET['s']
if not s:
if not (s := request.GET['s']):
return render(request,'home.html')
else:
post_list = Article.objects.filter(title__icontains = s)
if len(post_list) == 0 :
return render(request,'archives.html', {'post_list' : post_list,
'error' : True})
else :
return render(request,'archives.html', {'post_list' : post_list,
'error' : False})
post_list = Article.objects.filter(title__icontains = s)
return (
render(
request,
'archives.html',
{'post_list': post_list, 'error': True},
)
if len(post_list) == 0
else render(
request,
'archives.html',
{'post_list': post_list, 'error': False},
)
)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function blog_search 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.

1 participant