mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Fixes for the Group application
This commit is contained in:
@@ -10,7 +10,7 @@ class Migration(DataMigration):
|
||||
for group in orm['auth.Group'].objects.all():
|
||||
try:
|
||||
obj = orm.GroupInformation.objects.get(group=group)
|
||||
except orm['auth.Group'].DoesNotExist:
|
||||
except orm.GroupInformation.DoesNotExist:
|
||||
obj = orm.GroupInformation(group=group)
|
||||
obj.save()
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ class GroupInformation(models.Model):
|
||||
group = models.OneToOneField(Group)
|
||||
|
||||
type = models.IntegerField("Group Type", choices=GROUP_TYPE_CHOICES, default=GROUP_TYPE_PERMISSION)
|
||||
admins = models.ManyToManyField(User)
|
||||
admins = models.ManyToManyField(User, blank=True)
|
||||
public = models.BooleanField("Public", default=False, help_text="Indicates if the group is visible to all")
|
||||
requestable = models.BooleanField("Requestable", default=False, help_text="Indicates if people can request to join this group")
|
||||
|
||||
description = models.TextField(help_text="Description of the group and its permissions")
|
||||
description = models.TextField(help_text="Description of the group and its permissions", blank=True)
|
||||
|
||||
def save(self):
|
||||
if self.group and (self.group.eveplayercorporation_set.count() or self.group.eveplayeralliance_set.count()):
|
||||
|
||||
@@ -22,11 +22,11 @@ def group_list(request):
|
||||
else:
|
||||
groups = Group.objects.select_related('groupinformation').filter(Q(groupinformation__public=True) |
|
||||
Q(groupinformation__admins__in=[request.user]) |
|
||||
Q(user_set__in=[request.user]))
|
||||
Q(user__in=[request.user]))
|
||||
|
||||
# Process the query into a list of tuples including status
|
||||
group_list = []
|
||||
for group in groups:
|
||||
for group in set(groups):
|
||||
if request.user in group.groupinformation.admins.all():
|
||||
status = "Admin"
|
||||
elif request.user in group.user_set.all():
|
||||
|
||||
Reference in New Issue
Block a user