+1  A: 

You could probably hack something up to inject the request into the form instantiation, but why would you bother? Generic views are meant as a quick-and-easy solution to the basic requirements only. As soon as you start needing massive customisations, you might as well just write the actual view yourself. It's not very much code, after all.

Daniel Roseman
+1  A: 

Look at that:

url(r'^add$', create_object_with_request, {'template_name':'tpl.html','form_class':MyModelForm,'post_save_redirect':'/'},name = 'add'),

,

def create_object_with_request(request, *args, **kwargs):
    def inject_request(fun):
        def helper(*args, **kwargs):
            return fun(*args, request=request, **kwargs)
        return helper
    kwargs['form_class'] = inject_request(kwargs['form_class'])
    return create_object(request, *args, **kwargs)

So you have passed request to your class constructor. Or you can add it as attribute:

def create_object_with_request(request, *args, **kwargs):
    def inject_request(fun):
        def helper(*args, **kwargs):
            res = fun(*args, **kwargs)
            res.request = request
            return res
        return helper
    kwargs['form_class'] = inject_request(kwargs['form_class'])
    return create_object(request, *args, **kwargs)
Tomasz Wysocki
thnx this helps)
Evg
+1  A: 
Evg