python - Django get_context_data() variable gets overwritten somewhere -


This code example is simplified, but it may be that someone knows that the problem is without the correct copy of the code Therefore:

class FooView (TemplateView): template_name = 'foo.html' def get_context_data (auto, ** kwargs) reference = super (FooView, itself) .get_context_data (** kwargs). .. # We receive links from domain ... args = {'domain': domain} references. Update (Args) Import PDB; Pdb.set_trace () # Here is a return value reference in the 'domain'

HTML template foo.html 'domain' to access the value of 'code Attempts> {{Domain}} , but this is none.

This happens when I use the 'domain' as a label. So if I change domain to domain1 or foo - it works

How is this possible? Is it possible that the name of the domain can be overwritten in some way, maybe there is some clue in some?

Edit get_context_view -> get_context_data (incorrect type)

EDIT2 My 'domain' reference variable is written by context_processor . Function-based ideas were used when all worked fine. After switching to class-based ideas - started to overwrite the 'domain'. Maybe get_context_data () strong is not enough? What is the method to stop the reference processor from writing on the variable?

Overwrite the reference that passes data with the data from the reference processor that is known as templateView. Which is more consistent with render .

You should be able to correct it by overwriting render_to_response on your view:


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -