Django Groups Management

Dev-DJ
Dec 28, 2020

--

I faced a problem while working with Django…
How can we show Content-A to Group-A and so on..?

Well now, I have the answer to it!

Part-1: Creating groups

As soon as you’ll login to your django dashboard, you can find ‘Groups’ in Authentication And Authorization section

Add a few groups…

Part-2: Creating a variable

Go to this directory of you virtual environment Django/Contrib/Auth
If you don’t use virtual environment…

Find this file:

You have to find AbstractUser class

Last content you’ll find there should be: email_user
Next, copy-paste these lines:

In name, you add your group’s name
In def variable, you can add whatever you want

Step-3: HTML

Use if/else statements to create logic in HTML page
Example:

HTML File for if/else logic

Hope you have now cleared your “doubty” brain

--

--

Dev-DJ
Dev-DJ

Written by Dev-DJ

I am Dev-DJ, developer and owner of Dev-DJ.digital | Thanks

No responses yet