Skip to content

Commit

Permalink
Merge pull request #99 from Shalevro2/fix-create-article-return
Browse files Browse the repository at this point in the history
Fixing create_article view
  • Loading branch information
Yarboa authored Jan 18, 2023
2 parents 133d181 + b351da2 commit db3ab2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 1 addition & 6 deletions projboard/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,7 @@ def test_fill_article_post(client, article, django_capture_on_commit_callbacks):
'user_id': 1,
'content': article.content
})

# Page after the post
template_names = set(tmpl.origin.template_name for tmpl in response.templates)
# TODO change board.html to my_article.html
assert 'landing/homepage.html' in template_names
assert response.status_code == 200
assert response.status_code == 302


@pytest.mark.django_db
Expand Down
3 changes: 1 addition & 2 deletions projboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def create_article(request):
form = CreateArticleForm(request.POST, initial={'user_id': user})
if form.is_valid():
form.save()
# TODO when we end to create the "my articles" page, change the redirect
return render(request, 'landing/homepage.html', {'articles': Article.search_by_user(user)})
return redirect(f'/my_articles/{user.nickname}')
elif request.method == "DELETE":
raise Http404()
else:
Expand Down

0 comments on commit db3ab2d

Please sign in to comment.