Python Django, access to function value through urls?
<p>how can I get the value of "otro" function ?, this code works but it only show me the value of get function, how can get the value of otro? I do not understand how to do it un the urls.</p>

<pre><code>views:

from django.views.generic import ListView, View

from . models import Autor
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect

def inicio(request):
    return HttpResponse('HOLA')


# Create your views here.
class MiVista(View):
    def get(self, request):
        # &lt;la logica de la vista&gt;
        return HttpResponse('resultado')

    def otro(self, request):
        # &lt;la logica de la vista&gt;
        return HttpResponse('otro')



urls:

from django.conf.urls import url, include
from django.contrib import admin
from .import views
from .views import MiVista

urlpatterns = [

    url(r'^hola$', views.inicio),
    url(r'^indice/', MiVista.as_view()),



]
</code></pre>

<p>Thank you !</p>

<p>Django has <a href="https://docs.djangoproject.com/en/1.10/topics/class-based-views/intro/" rel="nofollow">class based generic views</a>, a system that allows you to use basic functionally without writing repetitive code. If you would like to return a <code>HttpResponse</code> with custom output, like "otro" or a JSON response, you wouldn't like to have another method inside a generic view because you cannot call it (If you would like to determine what can and cannot be done with generic views, click the link above). Instead, you would want to do what you have done with the <code>incido</code> function.</p>

<p>try something like this (and add it to the urls.py module):</p>

<pre><code>def inicio(request):
    return HttpResponse('HOLA')

# Create your views here.
class MiVista(View):
    def get(self, request):
        # &lt;la logica de la vista&gt;
        return HttpResponse('resultado')

def otro(request):
    # &lt;la logica de la vista&gt;
    return HttpResponse('otro')
</code></pre>

python django