Most all applications have some sort of permission levels or flags. There are many ways to accomplish permissions/flags and one that I like to use recently has been storing numbers in a single column and doing bitwise operation comparisons to figure out if the permission/flag exists.
If you have never heard of bitwise operators before I think you should probably take a look at the following links before proceeding.
Basically a bitand (&) operation does a comparison on equal bit patterns lengths.
0 & 0 = 0
0 & 1 = 0
1 & 0 = 0
1 & 1 = 1
Instead of dealing with bit combinations you can use the decimal representation. If you insist on learning more I would check out the following link. Good luck staying awake.
In this very simple example I take a dictionary of permission levels and look up the a permission level based on a binary (base 2) number stored.
Below is a simple example of a dictionary:
So with this example dictionary if you wanted to grant addUsers (1) and createPosts (8) the number would be 1 + 8 = 9. Next all you have to do is use python bitand operator (&) to check if a specific permission exists within the number. Below is an example:
This just touches the surfice of bitwise operators but it has been really handy for dealing with permissions and flags as you only store 1 value. There are many ways to accomplish all problems and this may not be the best for your situation but has been great in certain situations for me. :)