O
O
Oleg Vedernikov2016-10-18 23:38:52
Django
Oleg Vedernikov, 2016-10-18 23:38:52

How to pass data from a method of one class to a method of another?

Tell me please,

from django.http import HttpResponseRedirect
from django.views.generic import FormView
from django.core.urlresolvers import reverse

class SomeForm(FormView):
    form_class = some_form

    def form_valid(self, form):
        # отсюда осуществить перенаправление
        # и отправить form в метод def get класса, что ниже
        return HttpResponseRedirect(reverse('urlname')))


class SomeView(object):

    def get(self, request, *args, **kwargs):
        # тут эту форму получить


# при этом url SomeView должен состоять
# из одного конкретного слова, не более
url(r'/word/$', SomeView.as_view())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2016-10-18
@sim3x

https://docs.djangoproject.com/en/1.10/ref/class-b...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question