Like Juan says,
Read the documentation for modules and dictionaries and I think you will be
better off. However, here is a quick rundown of your questions:
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.
UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.
MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.
CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.
NumericPasswordValidator',
},
]
1. The first item in the list is the first dictionary that is present. A
dictionary in Python starts with a { and ends with a }. So the first item
is:
{
'NAME': 'django.contrib.auth.password_validation.
UserAttributeSimilarityValidator',
},
The AUTH_PASSWORD_VALIDATORS is a list of dictionaries with only one key
("NAME") and one item in them. So this is the first item and therefore the
first validator in this case.
2. Your assumption on dictionaries is wrong because "NAME" is not the
dictionary, but rather a KEY IN a dictionary (the entire first dictionary
is under bullet point 1 here).
3. The dot notation (as you call it) references a class that you can find
if you look in the django package, under folder contrib, folder auth, file
password_validation.py you will find a class class
UserAttributeSimilarityValidator. See the "dots" as directories / files
(they are modules).
So there is really not that much to explain here - it is probably simpler
than you expect it to be :-)
Regards,
Andréas
2018-02-16 5:09 GMT+01:00 Juan Pablo Romero Bernal <[email protected]>
:
> Hi,
>
> You must read: https://docs.python.org/3/tutorial/modules.html
>
> and
>
> https://docs.python.org/3/tutorial/datastructures.html#dictionaries
>
> Cheers,
>
>
> On Thu, Feb 15, 2018 at 8:06 PM, drone4four <[email protected]> wrote:
>
>> In, “Password management in Django
>> <https://docs.djangoproject.com/en/2.0/topics/auth/passwords/#how-django-stores-passwords>”,
>> it explains that this particular doc is for advanced users, like Django
>> admins who need to choose different hashing algorithms. So it’s not really
>> necessary for a beginner user like me to understand. From the doc:
>>
>> ...depending on your requirements, you may choose a different algorithm,
>>> or even use a custom algorithm to match your specific security situation.
>>> Again, most users shouldn’t need to do this – if you’re not sure, you
>>> probably don’t. If you do, please read on...
>>
>>
>> I don’t. So I don’t need to continue reading.
>>
>> But I do have some questions about dot notation in general as some code
>> appears in settings.py. Lines 87 - 100 in this file appear as follows:
>>
>> AUTH_PASSWORD_VALIDATORS = [
>> {
>> 'NAME': 'django.contrib.auth.password_
>> validation.UserAttributeSimilarityValidator',
>> },
>>
>> {
>> 'NAME': 'django.contrib.auth.password_
>> validation.MinimumLengthValidator',
>> },
>>
>> {
>> 'NAME': 'django.contrib.auth.password_
>> validation.CommonPasswordValidator',
>> },
>>
>> {
>> 'NAME': 'django.contrib.auth.password_
>> validation.NumericPasswordValidator',
>> },
>> ]
>>
>>
>>
>> Can someone please identify the first item in this list? I understand
>> that all the items in this list are dictionaries. The first dictionary is
>> named, ‘NAME’. The key involves libraries, functions, variables, class
>> names and more functions. Which is which? Is `django` the library? What is
>> `contrib`? Is this a function name or a class name? If `contrib` is a
>> function name or class name, where is it located in my venv or Django
>> project folder?
>>
>> What does each word in the dictionary mean or refer to? Can some one
>> please explain the syntax?
>>
>> Thanks for your attention.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/e285f69d-3aad-4d99-b46e-7f6be5ccbffb%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/e285f69d-3aad-4d99-b46e-7f6be5ccbffb%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Juan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAJK1Jg26MJz2xHYQyH7EdH44EmoUNcdW1D%2BMOfGtmeq4yr8Z9A%
> 40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJK1Jg26MJz2xHYQyH7EdH44EmoUNcdW1D%2BMOfGtmeq4yr8Z9A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAK4qSCcAAva9qej7EikLPr7NYeo%2Bk5A%3D8n%2B9MG9-g3PLcPWmpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.