Hi, I have some experience with Python3, Django is new to me. As I work my way through the tutorials (they are great!) I find a few things that I have a hard time distinguishing. Is there an overview of the following somewhere? Or can someone help me out?
- From Python I know the
class.method
and theclass.attribute
notation. That seems to be the same in Django, as long we speek about python code. The seperator ist.
- From Python I know the underscore (
_
) as a normal character, which can be used in class names, method names and so on. Even a double underscore (__
) is used this way (as indef __init__(self)
. In Django that seems different. In the tutorial part 5 it comes to an expression like
return Question.objects.filter(pub_date__lte = timezone.now())
. There the__lte
seems not to be part of the name which begins withpub_date
, but to be a seperator. What about that? How does it work? Is it a feature of Python or Django to split names? Where points__lte
to? - Then we have something with namespaces, which for example looks like
polls:vote
, seperated by:
, in a template file:<form action="{% url 'polls:vote' question.id %}" method="post">
and corresponds with theapp_name = 'polls'
in theurls.py
. Again: is it a feature of Django or Python to provide these namespaces? - Are there any other hierarchies of this kind?
Thanks for any hint!