Пример #1
0
    def _post_response(self, form_data):
        url = reverse('website:contact')
        request = self.factory.post(url, form_data)

        store = _create_session()
        request.session = store
        messages = FallbackStorage(request)
        request._messages = messages
        return contact_view(request)
Пример #2
0
    def _post_response(self, form_data):
        url = reverse('website:contact')
        request = self.factory.post(url, form_data)

        store = _create_session()
        request.session = store
        messages = FallbackStorage(request)
        request._messages = messages
        return contact_view(request)
Пример #3
0
    def _get_response(self, user=None, session_data={}, referer=None):
        url = reverse('website:contact')
        request = self.factory.get(url)
        if user:
            request.user = user
        if referer:
            request.META['HTTP_REFERER'] = referer
        store = _create_session()
        request.session = store

        for k, v in session_data.items():
            request.session[k] = v

        return contact_view(request)
Пример #4
0
    def _get_response(self, user=None, session_data={}, referer=None):
        url = reverse('website:contact')
        request = self.factory.get(url)
        if user:
            request.user = user
        if referer:
            request.META['HTTP_REFERER'] = referer
        store = _create_session()
        request.session = store

        for k, v in session_data.items():
            request.session[k] = v

        return contact_view(request)