Python Django Interview Questions & Answers
Question: What are Django shortcut functions?
Ans: The package
More Read django.shortcuts
collects helper functions and classes that
“span” multiple levels of MVC. These functions/classes
introduce controlled coupling for convenience’s sake.
Question: What is the function of render()?
Ans: render() Combines a given template with a given context dictionary and returns an HttpResponse object with that rendered text. Django does not provide a shortcut function which returns a TemplateResponse because the constructor of TemplateResponse offers the same level of convenience as render() .
Ans: render() Combines a given template with a given context dictionary and returns an HttpResponse object with that rendered text. Django does not provide a shortcut function which returns a TemplateResponse because the constructor of TemplateResponse offers the same level of convenience as render() .
Question: What is the diff between {{ }} and {% %}?
Ans: There are three category in the template in Django:
Ans: There are three category in the template in Django:
1> Template Variable {{ }}: To render variables in the template or displaying variables.
2> Template Tag {% %}: For sentences such as
if
and for
or to call tags such as load
, static
, etc.
3> Template Filter:
{{variable |filter:arg}}
Ans: Cross-site request forgery, also known as one-click attack or session riding and abbreviated as CSRF
(sometimes pronounced sea-surf) or XSRF, is a type of malicious exploit
of a website where unauthorized commands are transmitted from a user
that the web application trusts.
Ans: That said, assuming an attacker can do 100,000 requests per second, it should take around 2.93 million years on average to brute force a 64-bit CSRF token. (And there shouldn't be more than one token in the whole token space, unlike with session id's.) So, maybe 64 bits is enough.
No comments:
Post a Comment