Skip to Content
Hands-On Blockchain for Python Developers
book

Hands-On Blockchain for Python Developers

by Arjuna Sky Kok
February 2019
Intermediate to advanced
450 pages
9h 59m
English
Packt Publishing
Content preview from Hands-On Blockchain for Python Developers

Views

Now let's create the view file of the videos application. A view is a controller that is like an API endpoint. The file is located in decentralized_videos/videos/views.py. Refer to the code file at the following GitLab link for the full code: https://gitlab.com/arjunaskykok/hands-on-blockchain-for-python-developers/blob/master/chapter_12/decentralized_videos/videos/views.py:

from django.shortcuts import render, redirectfrom videos.models import videos_sharingdef index(request):    videos = videos_sharing.recent_videos()    context = {'videos': videos}    return render(request, 'videos/index.html', context)......def like(request):    video_user = request.POST['video_user']    index = int(request.POST['index'])    password = request.POST['password'] video_liker ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Blockchain in Action

Blockchain in Action

Bina Ramamurthy
Learn Python by Building a Blockchain and Cryptocurrency

Learn Python by Building a Blockchain and Cryptocurrency

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781788627856Supplemental Content