12311k

Untitled

Feb 12th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1.  
  2. def subscribe(request):
  3. if request.method == 'GET':
  4. context = {
  5. 'where': request.path
  6. }
  7. resp = render(request, 'templates/articles/subscribe_form.html', context)
  8. return resp
  9. elif request.method == 'POST':
  10. author = request.POST['author']
  11. user_email = request.POST['email']
  12. author_articles = []
  13. for article in articles_list:
  14. if author == article[1]:
  15. author_articles.append(article)
  16. context = {
  17. 'author': author,
  18. 'email': user_email,
  19. 'articles': generate_html(author_articles)
  20. }
  21. return render(request, 'templates/articles/subscribe.html', context)
Advertisement
Add Comment
Please, Sign In to add comment