Sunday 17 November 2019

Python - super() Kudos - RAYMOND HETTINGER - Python Core dev Team




Its always a pleasure to read insights from the CORE developers of any Programming Language / Framework - one such is RAYMOND HETTINGER , i got introduced to his work reading the - PEP - 289 -- https://www.python.org/dev/peps/pep-0289/ ,

His excellent insights can be read here on his blog -- https://rhettinger.wordpress.com/

Totally liked the blog post about - super()
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/

Further reading --- other sources with similar content --- or code examples --- 

https://github.com/django/django/blob/0b70985f42da7a8eb2e206e6780681b7849564ef/django/db/models/functions/text.py#L49

https://github.com/django/django/blob/0b70985f42da7a8eb2e206e6780681b7849564ef/django/db/models/functions/text.py#L21

https://realpython.com/python-super/

https://github.com/westernesque/a-history-of-birds/blob/e466240ad87b46bb2b164e42335720d3102d84b4/data/shaders/terrain_shader.py#L14

Ugly alternatives to - Generator Expressions

 
 
 
 
 
 
 
print("URL for PEP - 289 = https://www.python.org/dev/peps/pep-0289/")
URL for PEP - 289 = https://www.python.org/dev/peps/pep-0289/
In [2]:
sum([x*x for x in range(10)]) # Source -  PEP - 289
Out[2]:
285
In [3]:
#So whats ->  x in range(10):
for x in range(10): # as seen below the variable - x , will take all values from 0-9 
    print(x)
0
1
2
3
4
5
6
7
8
9
In [5]:
mylist = [] # Init empty list 
for x in range(10): 
    mylist.append(x) # Append all ints from 0-9 
In [8]:
# Multiply Consecutive Elements of LIST - mylist 
#
print("myList = ",mylist)
n = 2
sqr_of_nums = []
for e in range(len(mylist)):
    sqr_of_nums.append(mylist[e]*mylist[e])
print("List of Product's of Consecutive Nums = ",sqr_of_nums)
print("SUM of Product's of Consecutive Nums = ",sum(sqr_of_nums))
myList =  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
List of Product's of Consecutive Nums =  [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
SUM of Product's of Consecutive Nums =  285
In [ ]:
 

Saturday 16 November 2019

Relational Algebra - 101

This blog post as most others here is in a "notes to myself" category , in case its useful to any other reader - well thats great , i dont really have the time to create very readable user focused content as on date .

A relational database is composed of two-dimensional tables. (A table can also be called a relation, although relational "purists" would argue that there is a subtle distinction between the two.) Each "row" of a table is called a tuple. Each tuple is composed of fields, one for each attribute of the table. (The attributes are the names we associate with the fields/columns.)  SOURCE =
https://www.cs.scranton.edu/~mccloske/courses/cmps340/rel_alg_intro_lec.html


Above image SOURCE == https://medium.com/@sahirnambiar/relational-algebra-the-underpinnings-of-sql-74959481231a


  1. RENAMING --- 
  2. SELECTION ---
  3. PROJECTION ---














Further Readings and the main SOURCE for the Content of this Blog post --  Kindly note due credit goes to each and every of these links 

StanfordDBClass - YouTube - https://www.youtube.com/watch?v=tii7xcFilOA

https://www.cs.scranton.edu/~mccloske/courses/cmps340/rel_alg_intro_lec.html

https://www.cs.helsinki.fi/u/laine/tkpv/algebra/buildingqueries.html
 
https://db.grussell.org/section010.html 

https://www3.cs.stonybrook.edu/~kifer/Courses/cse532/slides/ch5.pdf

https://www.cs.uct.ac.za/mit_notes/database/htmls/chp02.html

https://www.javatpoint.com/dbms-relational-algebra

https://www.guru99.com/relational-algebra-dbms.html

http://www.databasteknik.se/webbkursen/relalg-lecture/index.html

https://web.cs.ucdavis.edu/~green/courses/ecs165a-w11/3-ra.pdf

http://www.nyu.edu/classes/jcf/CSCI-GA.2433-001_sp15/slides/session5/RelationalAlgebra-RelationalCalculus-SQL.pdf

https://www.studytonight.com/dbms/relational-algebra.php

https://beginnersbook.com/2019/02/dbms-relational-algebra/

https://www3.cs.stonybrook.edu/~kifer/Courses/cse532/slides/ch5.pdf
https://www.guru99.com/relational-algebra-dbms.html
https://www.studytonight.com/dbms/relational-algebra.php

http://dinesql.blogspot.com/2017/06/relational-algebra-joins-theta-join-equijoin-natural-join-outer-join-semijoin.html

Thursday 14 November 2019

React.js Hello World - Node , NPX , NPM




This blog post as most others here is in a "notes to myself" category , in case its useful to any other reader - well thats great , i dont really have the time to create very readable user focused content as on date .

Just starting with React.js , few observations , specially so to document the delta/diff , that i see between the Python/CONDA/ Miniconda style of packaging vs. the NPM/NVM and Node/NodeJS style of packaging.

#
$ node -v
v12.13.0
$ whereis node
node: /home/dhankar/.nvm/versions/node/v12.13.0/bin/node
#


Firstly - where was my option to choose where to install Node ? 
I have node installed in my Home DIR - why ?

#
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13226  100 13226    0     0   3804      0  0:00:03  0:00:03 --:--:--  3804
=> Downloading nvm from git to '/home/dhankar/.nvm'
=> Cloning into '/home/dhankar/.nvm'...
remote: Enumerating objects: 278, done.
remote: Counting objects: 100% (278/278), done.
remote: Compressing objects: 100% (249/249), done.
remote: Total 278 (delta 33), reused 88 (delta 16), pack-reused 0
Receiving objects: 100% (278/278), 142.36 KiB | 0 bytes/s, done.
Resolving deltas: 100% (33/33), done.
Checking connectivity... done.
=> Compressing and cleaning up git repository

=> Appending nvm source string to /home/dhankar/.bashrc
=> Appending bash_completion source string to /home/dhankar/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
(demo_venv) dhankar@dhankar-VPCEB44EN:~$

#


Why wasnt i informed that there is a GIT Repo thats going to be cloned ? 

Kudos , the package manager ended up making the required edits to my
/home/dhankar/.bashrc , which is cool as most python package managers that i know of dont make changes there or the human is supposed to edit the - /home/dhankar/.bashrc , and then also source/save etc . 






npx - So whats the binary file named - npx  ?

npx is a for the npm registry ( the npm registry being similar to the PyPi for Python the listing or register for all the packages for Python ) what probably "pip / pip3" is for Conda or the PyPi.

Quote ---- from Source = https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b


npx is a tool intended to help round out the experience of using packages from the npm registry — the same way npm makes it super easy to install and manage dependencies hosted on the registry, npx makes it easy to use CLI tools and other executables hosted on the registry.

---- UnQuote



# terminal dump below ----

dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/demo/nginx_dc_oct19$ npx create-react-app my-app
npx: installed 91 in 14.483s

Creating a new React app in /media/dhankar/Dhankar_1/demo/nginx_dc_oct19/my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...


> core-js@2.6.10 postinstall /media/dhankar/Dhankar_1/demo/nginx_dc_oct19/my-app/node_modules/babel-runtime/node_modules/core-js
> node postinstall || echo "ignore"


> core-js@3.2.1 postinstall /media/dhankar/Dhankar_1/demo/nginx_dc_oct19/my-app/node_modules/core-js
> node scripts/postinstall || echo "ignore"

+ react@16.11.0
+ react-scripts@3.2.0
+ react-dom@16.11.0
added 1475 packages from 693 contributors and audited 904933 packages in 113.47s
found 0 vulnerabilities


Success! Created my-app at /media/dhankar/Dhankar_1/demo/nginx_dc_oct19/my-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd my-app
  npm start

Happy hacking!
dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/demo/nginx_dc_oct19$ ls -ltr

# Ends - terminal dump
#




Initial / default contents of the - package.json , file

{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-scripts": "3.2.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}


While trying to paste in the content of the - package-lock.json , file , blogger throws an error - so i guess i let that be for now , probably will check it into Git later on ....

Suffice to say that the DIST wheel for the package manager has created the -package-lock.json file , and the META-DATA for the package is written within this file , few lines extract from this file is as seen below ....


{
"name": "my-app",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
"integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
"requires": {
"@babel/highlight": "^7.0.0"
}
},
"@babel/core": {
"version": "7.6.0",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.6.0.tgz",
"integrity": "sha512-FuRhDRtsd6IptKpHXAa+4WPZYY2ZzgowkbLBecEDDSje1X/apG7jQM33or3NdOmjXBKWGOg4JmSiRfUfuTtHXw==",
"requires": {
"@babel/code-frame": "^7.5.5",
"@babel/generator": "^7.6.0",
"@babel/helpers": "^7.6.0",
"@babel/parser": "^7.6.0",
"@babel/template": "^7.6.0",
"@babel/traverse": "^7.6.0",
"@babel/types": "^7.6.0",
"convert-source-map": "^1.1.0",
"debug": "^4.1.0",
"json5": "^2.1.0",
"lodash": "^4.17.13",
"resolve": "^1.3.2",
"semver": "^5.4.1",
"source-map": "^0.5.0"
},


Further details about the package.json file and its mandatory "directives" can be read here - https://nodejs.org/en/knowledge/getting-started/npm/what-is-the-file-package-json/

The  package.json file is a MANIFEST file - Source - WIKI - https://en.wikipedia.org/wiki/Manifest_file
A manifest file in computing is a file containing metadata for a group of accompanying files that are part of a set or coherent unit. For example, the files of a computer program may have a manifest describing the name, version number, license and the constituting files of the program.

Linux distributions rely heavily on package management systems for distributing software. In this scheme, a package is an archive file containing a manifest file. The primary purpose is to enumerate the files which are included in the distribution, either for processing by various packaging tools or for human consumption. 


All NPM ( Node Package Manager )  packages will have a package.json file , further questions that come up at this stage .


So whats NPM - its a package Manager similar to "pip" , Conda / Miniconda etc ...from the Python world. Within the NPM structure .  What are Local and Global Packages ? What are dependencies and dev - dependencies ?

To see a basic level help screen related to NPM - at the terminal

$npm 

dhankar@dhankar-VPCEB44EN:~/.npm$ npm

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    /home/dhankar/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.12.0 /home/dhankar/.nvm/versions/node/v12.13.0/lib/node_modules/npm
dhankar@dhankar-VPCEB44EN:~/.npm$  







if and when we need to create a - package.json , file at the terminal - 


$ npm init 



This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (dhankar_1)
version: (1.0.0)
description: test_npm_package
entry point: (index.js)
test command:
git repository:
keywords:
author: RohitDhankar
license: (ISC)
About to write to /media/dhankar/Dhankar_1/package.json:

{
  "name": "dhankar_1",
  "version": "1.0.0",
  "description": "test_npm_package",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "RohitDhankar",
  "license": "ISC"
}


Is this OK? (yes)
dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1$ ls -ltr
total 8076
drwxrwxr-x  7 dhankar dhankar              4096 Oct 29 22:12 demo
drwxrwxr-x  4 dhankar dhankar              4096 Oct 30 20:43 a5_test_sphinx
-rw-rw-r--  1 dhankar dhankar               233 Nov 15 12:02 package.json
dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1$
#





The React toolchain recommendations and what they mean [FOO_TBD]

The React team primarily recommends these solutions:
  • If you’re learning React or creating a new single-page app, use Create React App.
  • If you’re building a server-rendered website with Node.js, try Next.js.
  • If you’re building a static content-oriented website, try Gatsby.
  • If you’re building a component library or integrating with an existing codebase, try More Flexible Toolchains.


Quote ---- from Source = Learning React - by Alex Banks and Eve Porcello

Popularity of Functional JavaScript
In addition to the changes emerging at a language level, there is a lot of momentum around functional JavaScript programming. JavaScript isn’t necessarily a functional language, but functional techniques can be used in JavaScript code.
React emphasizes functional programming over object-oriented programming. This shift in thinking can lead to benefits in areas like testability and performance. But when a lot of React materials assume an understanding of the paradigm, it can be hard to learn so much
at once.


Quote ---- from Source = Learning React - by Alex Banks and Eve Porcello


FOO_Q----is the search index for QUESTIONS
FOO_A---- the search index for Answers / Links to further reads

FOO_Q---- Whats Babel ?

FOO_A---- Inspired by the Tower of "BABEL" from the pre-christ history (Book of Genesis) babel is --- SOURCE --- https://medium.com/front-end-weekly/a-world-of-javascript-transpilers-b3b7b880a1be

Aptly named, Babel is a platform that translates many of the extended language functionalities into ES5, which is a version of ECMAScript that is standard on all modern browsers. This makes Babel a launchpad for many of the slick and shiny JavaScript platforms out there because it allows us to extend the functionality of JavaScript while maintaining its backwards-compatibility. In other words, it lets you build out JavaScript without breaking the web!

For example, Babel is an integral part of the React build. In React, when we use JSX to build out the virtual DOM elements in psuedo-HTML, we are writing in a language that Babel is built to understand. In spinning up a build, we are using Babel to translate the JSX, as well as the rest of the JavaScript in React, into a single ES5 file. Ever looked at the static .js file of an app you’ve spun up from React and noticed that it’s literally thousands of lines longer than your original project files? Yep, that’s Babel. In fact, Babel has its own preset specifically for React, among others:




FOO_Q---- Whats JSX?

FOO_Q---- Whats WEBPACK ?

FOO_Q---- Whats Code Splitting ?

FOO_Q---- Whats Code Compression  ?


FOO_Q---- Whats SCSS - Why it needs to be Pre-processed ?

FOO_Q---- Whats REDUX , how is it used as a Client Data Container ?




FOO_Q---- Whats "transpiling" code ? Why we need to do that with JS6 - REACT Code?

FOO_A--- from Source = Learning React - by Alex Banks and Eve Porcello

Transpiling ES6
Not all web browsers support ES6, and even those that do don’t support everything.
The only way to be sure that your ES6 code will work is to convert it to ES5 code
before running it in the browser. This process is called transpiling. One of the most
popular tools for transpiling is Babel.[https://babeljs.io/]



FOO_Q---- Whats JEST Testing , Whats a REACT ROUTER ?

FOO_Q----  Whats SENTRY -- https://sentry.io/for/react/





Further reads --- React Conf's

REACT RALLY - http://www.reactrally.com

Tuesday 5 November 2019

Django --->> settings.py --->> AUTH_USER_MODEL =























This blog post as most others here is in a "notes to myself" category , in case its useful to any other reader - well thats great , i dont really have the time to create very readable user focused content as on date .

Use case is simple - creating USER PROFILE's which will add  Parameters to the DJANGO USER - parameter's such as DEPARTMENT / SUB DEPARTMENT / BIODATA etc . Will use this to classify users at time of REGISTRATION itself. Will use this Meta-data to restrict visibility to content - utilizing the built in django.contrib.auth.mixins , specifically / initially using - LoginRequiredMixin and the UserPassesTestMixin.

As of now anyone can REGISTER on DigitalCognition by providing a NON- UNIQUE email ID and an UNIQUE USERNAME . The Non Unique email id is a historical / legacy Django thing and am not going to change that as on date - as i do suppose there will always be a need to have Multiple User Logins for the same email ID - both for testing and production. Also as most users have to go through the ADMIN APPROVED ACCOUNTS LOGIN https://digitalcognition.co.in/admin_approved_accounts/register/ to reach the Landing page which as on date is at URL  https://digitalcognition.co.in/dc/datasets_listView/,.


Quoting from the official Django docs -


Extending the existing User model

There are two ways to extend the default User model without substituting your own model. If the changes you need are purely behavioral, and don’t require any change to what is stored in the database, you can create a proxy model based on User. This allows for any of the features offered by proxy models including default ordering, custom managers, or custom model methods.

Am going to try the various approaches mentioned below and will stop at whatever works for me for now as an interim , may get back to further tweaking later :- 

 1 Create a PROXY User Model- proxy_user_model - based on the official Django , model named User which exists at path - /home/dhankar/anaconda2/envs/demo_venv/lib/python3.6/site-packages/django/contrib/auth/models.py



2. Adding Profile Features like a BIODATA or a DEPARTMENT to the existing default User Model - This is not a recommended approach and the Django official docs and lots of other sources on the internet actually recommend against this . Within this there are again two paths to take- the easier one is recommended to be to subclass the AbstractUser . On various sources what is recommended is to subclass the AbstractUser and not try to subclass the AbstractBaseUser. Making changes of any kind to AbstractBaseUser will require more effort and also may mess-up other methods . To begin with in place of creating another custom user class which will sub-class the AbstractUser I will make changes within the default User model.  
The first challenge is to save within the psqlDB/PostGreSQL the input given by the user for a dummy biodata text field - initial code is as seen below.


class AbstractUser(AbstractBaseUser, PermissionsMixin):
"""
FOO - Its recommended to SubClass the AbstractUser Class and create own CustomUser Class like so -
class CustomUser(Abstractuser):
additional_user_fields = bio
FOO --- Im directly adding --->> additional_user_fields = bio , in here into the --- class AbstractUser
"""

"""
An abstract base class implementing a fully featured User model with admin-compliant permissions.
Username and password are required. Other fields are optional.
"""
username_validator = UnicodeUsernameValidator()
help_text_str_username = format_html('<div style="color:grey;"> {} <strong><b>{}</b></strong> {}</div>', 'Username is a Required Field. Your UserName for' , 'DigitalCognition', 'can have max - 150 characters. You may use Letters, digits and @/./+/-/_ only.')

username = models.CharField(
_('username'),
max_length=150,
unique=True,
help_text = help_text_str_username,
#help_text=_('Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.'),
validators=[username_validator],
error_messages={
'unique': _("A user with that username already exists within the DigitalCognition user database , kindly choose another username."),
},
)

bio = models.TextField(
_('bio'), #FOO_bio
max_length=500, blank=True)


first_name = models.CharField(_('first name'), max_length=30, blank=True)
last_name = models.CharField(_('last name'), max_length=150, blank=True)
email = models.EmailField(_('email address'), blank=True)
is_staff = models.BooleanField(
_('staff status'),
default=False,
help_text=_('Designates whether the user can log into this admin site.'),
)
is_active = models.BooleanField(
_('active'),
default=True,
help_text=_(
'Designates whether this user should be treated as active. '
'Unselect this instead of deleting accounts.'
),
)
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)

objects = UserManager()

EMAIL_FIELD = 'email'
USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

class Meta:
verbose_name = _('user')
verbose_name_plural = _('users')
abstract = True

def clean(self):
super().clean()
self.email = self.__class__.objects.normalize_email(self.email)

def get_full_name(self):
"""
Return the first_name plus the last_name, with a space in between.
"""
full_name = '%s %s' % (self.first_name, self.last_name)
return full_name.strip()

def get_short_name(self):
"""Return the short name for the user."""
return self.first_name

def email_user(self, subject, message, from_email=None, **kwargs):
"""Send an email to this user."""
send_mail(subject, message, from_email, [self.email], **kwargs)


class User(AbstractUser):
"""
Users within the Django authentication system are represented by this
model.

Username and password are required. Other fields are optional.
"""
class Meta(AbstractUser.Meta):
swappable = 'AUTH_USER_MODEL'
# FOO --swappable- https://stackoverflow.com/questions/22025476/what-is-swappable-in-model-meta-for


Some excellent explanations from SO almost 7 years back - asto whats with the Django - save(commit = False)

def save(self, commit=True):
user = super().save(commit=False)


https://stackoverflow.com/questions/12848605/django-modelform-what-is-savecommit-false-used-for

My current challenge is slightly diff , am trying to understand the flow of information - so to say .

Have posted two more questions on SO , have accepted one of the answers which led me to further learn the concepts / things mentioned below -

1/ The cleaned_data , dictionary ---...........

def clean_password2(self):
password1 = self.cleaned_data.get("password1")
password2 = self.cleaned_data.get("password2")
#bio = self.cleaned_data.get("bio") # Wont work
#print(bio) #prints None - as there is no BIO key within DICT - cleaned_data
if password1 and password2 and password1 != password2:
raise forms.ValidationError(
self.error_messages['password_mismatch'],
code='password_mismatch',
)
return password2











https://stackoverflow.com/questions/58770395/django-usermanagerbaseusermanager-question-why-wont-the-email-and-userna

SO Accepted Answer -- https://stackoverflow.com/a/58736034/4928635


Further when we have a look at the official Django tests for the UserModel and also look at the GitBlame / Change history for the code we can clearly see - these UserModel codes have been around for almost past seven years !!

https://github.com/django/django/blame/ec9d0123e0bf17b6219630ebe1c5f7240acc2743/tests/auth_tests/models/custom_user.py#L36



Further reading required  

Custom User Model + User Profile Model
https://testdriven.io/blog/django-custom-user-model/
https://www.codingforentrepreneurs.com/blog/how-to-create-a-custom-django-user-model
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html
https://stackoverflow.com/questions/57244525/extending-abstractbaseuser-not-hitting-modelbackend-django

https://docs.djangoproject.com/en/2.2/topics/auth/customizing/#changing-to-a-custom-user-model-mid-project
https://medium.com/@judegyeongbaejung/django-shortcuts-custom-user-models-a3e34ea3d689
https://django-improved-user.readthedocs.io/en/latest/_modules/django/contrib/auth/base_user.html
DJANGO MODULE --- Django Improved User ---- https://django-improved-user.readthedocs.io/en/latest/_modules/django/contrib/auth/base_user.html
https://docs.djangoproject.com/en/2.2/ref/contrib/auth/
https://stackoverflow.com/questions/24321308/django-forms-cleaned-data-missing-certain-fields?rq=1
https://stackoverflow.com/questions/48987669/django-can-i-omit-savecommit-false-in-this-case

FOO---->> https://stackoverflow.com/a/9658211/4928635
https://www.caktusgroup.com/blog/2019/04/26/how-switch-custom-django-user-model-mid-project/
Burhan Khalid --->> https://stackoverflow.com/a/25842236/4928635
https://wsvincent.com/django-referencing-the-user-model/
CUSTOM_USER_MODEL
 FOO MAIN ---- https://wsvincent.com/django-custom-user-model-tutorial/


DJANGO Official -
-->> MAIN  --- https://docs.djangoproject.com/en/2.1/topics/auth/customizing/#substituting-a-custom-user-model
https://docs.djangoproject.com/en/2.1/topics/auth/customizing/#auth-custom-user
https://docs.djangoproject.com/en/2.1/topics/auth/default/#topics-auth-creating-users
https://docs.djangoproject.com/en/2.1/ref/contrib/auth/
https://github.com/django/django/tree/b9cf764be62e77b4777b3a75ec256f6209a57671/tests/auth_tests/models


Django ---- User Profile --->> https://simpleit.rocks/python/django/adding-users-to-your-django-project-with-custom-user-model/
 UserPassesTestMixin ---->> https://github.com/search?l=Python&q=UserPassesTestMixin&type=Code
The UserPassesTestMixin --- test_func(self): ........... https://github.com/venkat0708/BalajiVV/blob/ddf74d26a7ecae3f3bc5a902dcab09bf8f30e448/products/views.py#L37
https://github.com/davehenton/skolagatt/blob/2c2af978906a28ae42502e1777eafc0043a042e8/common/mixins.py#L16


https://stackoverflow.com/a/7313429/4928635
https://stackoverflow.com/questions/47496966/django-multiple-user-profiles-design-decision
UserPassesTestMixin --- https://docs.djangoproject.com/en/2.2/topics/auth/default/#django.contrib.auth.mixins.LoginRequiredMixin
Django Custom User Model --- https://wsvincent.com/django-custom-user-model-tutorial/
FOO MAIN --- https://wsvincent.com/django-rest-framework-user-authentication-tutorial/
#
https://stackoverflow.com/questions/15296863/configure-django-usermanager-to-input-date-of-birth-for-superuser
https://stackoverflow.com/questions/51163088/self-model-in-django-custom-usermanager
https://stackoverflow.com/questions/58735856/django-usermodel-how-to-create-custom-text-field-within-the-django-contrib-a
https://stackoverflow.com/questions/32598287/django-error-saving-user-with-abstractbaseuser-and-baseusermanager
https://stackoverflow.com/questions/51163088/self-model-in-django-custom-usermanager
https://stackoverflow.com/questions/16606312/django-custom-user-model-and-usermanager