Django Groups Management

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

HTML File for if/else logic

Hope you have now cleared your “doubty” brain