Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Managing groups in Django Channels
class User(AbstractBaseUser, PermissionsMixin):
"""
Maintain user and its attributes
"""
@property
def group_name(self):
"""
Returns a group name based on the user's id to be used by Django Channels.
Example usage:
user = User.objects.get(pk=1)
group_name = user.group_name
"""
return "user_%s" % self.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.