Django Groups Management

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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store