diff --git a/app/groups/admin.py b/app/groups/admin.py index 904fa53..8fb7f2f 100644 --- a/app/groups/admin.py +++ b/app/groups/admin.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.contrib.auth.models import Group from django.contrib.auth.admin import GroupAdmin -from groups.models import GroupInformation, GroupRequest +from groups.models import GroupInformation, GroupRequest, GroupCategory class GroupRequestAdmin(admin.ModelAdmin): list_display = ('group', 'user', 'status', 'created_date', 'changed_by', 'changed_date') @@ -9,6 +9,7 @@ class GroupRequestAdmin(admin.ModelAdmin): list_filter = ('status',) admin.site.register(GroupRequest, GroupRequestAdmin) +admin.site.register(GroupCategory, admin.ModelAdmin) class SSOGroupInformationInline(admin.StackedInline): model = GroupInformation diff --git a/app/groups/models.py b/app/groups/models.py index e59e3ef..f6022bc 100644 --- a/app/groups/models.py +++ b/app/groups/models.py @@ -4,11 +4,22 @@ from django.contrib.auth.models import Group, User from groups.app_defines import * + +class GroupCategory(models.Model): + """Category to put groups into""" + + name = models.CharField('Category Name', max_length="250") + + def __unicode__(self): + return self.name + + class GroupInformation(models.Model): """ Extended group information """ group = models.OneToOneField(Group) + category = models.ForeignKey(GroupCategory, related_name='groups', null=True) type = models.IntegerField("Group Type", choices=GROUP_TYPE_CHOICES, default=GROUP_TYPE_PERMISSION) admins = models.ManyToManyField(User, blank=True) public = models.BooleanField("Public", default=False, help_text="Indicates if the group is visible to all") diff --git a/app/groups/templates/groups/group_list.html b/app/groups/templates/groups/group_list.html index 2d7aa75..9a24042 100644 --- a/app/groups/templates/groups/group_list.html +++ b/app/groups/templates/groups/group_list.html @@ -9,22 +9,33 @@
This is the list of your current groups, and groups you can request to be a member of.
{% if group_list %} +{% regroup group_list by category as groups_by_category %} + +{% for category in groups_by_category %} + +{% if category.grouper %} ++
| Group Name | Description | Status | Actions |
|---|---|---|---|
| {{ group }} | -{{ description }} | -{% if pending %}Request Pending{% else %}{% if status %}{{ status }}{% endif %}{% endif %} | -{% ifequal status None %}{% if requestable %}{% if moderated %}Request Membership{% else %}Join{% endif %}{% endif %}{% endifequal %} - {% if not fixed and status %}Leave {% endif %} - {% if status == 'Admin' or request.user.is_superuser %}{% if not fixed %}Admin{% endif %}{% endif %} | + {% for group in category.list %} +
| {{ group.group }} | +{{ group.description }} | +{% if group.pending %}Request Pending{% else %}{% if group.status %}{{ group.status }}{% endif %}{% endif %} | +{% ifequal group.status None %}{% if requestable %}{% if group.moderated %}Request Membership{% else %}Join{% endif %}{% endif %}{% endifequal %} + {% if not group.fixed and group.status %}Leave {% endif %} + {% if group.status == 'Admin' or request.user.is_superuser %}{% if not group.fixed %}Admin{% endif %}{% endif %} |