diff --git a/allianceauth/groupmanagement/migrations/0015_make_descriptions_great_again.py b/allianceauth/groupmanagement/migrations/0015_make_descriptions_great_again.py new file mode 100644 index 00000000..6d086c89 --- /dev/null +++ b/allianceauth/groupmanagement/migrations/0015_make_descriptions_great_again.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.2 on 2020-10-25 11:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("groupmanagement", "0014_auto_20200918_1412"), + ] + + operations = [ + migrations.AlterField( + model_name="authgroup", + name="description", + field=models.TextField( + blank=True, + help_text="Short description (max. 512 characters) of the group shown to users.", + max_length=512, + null=True, + ), + ), + ] diff --git a/allianceauth/groupmanagement/models.py b/allianceauth/groupmanagement/models.py index 035b9ba2..e36f7e2d 100644 --- a/allianceauth/groupmanagement/models.py +++ b/allianceauth/groupmanagement/models.py @@ -55,7 +55,6 @@ class RequestLog(models.Model): return user.profile.main_character - class AuthGroup(models.Model): """ Extends Django Group model with a one-to-one field @@ -76,46 +75,75 @@ class AuthGroup(models.Model): Open - Users are automatically accepted into the group Not Open - Users requests must be approved before they are added to the group """ + group = models.OneToOneField(Group, on_delete=models.CASCADE, primary_key=True) - internal = models.BooleanField(default=True, - help_text="Internal group, users cannot see, join or request to join this group.
" - "Used for groups such as Members, Corp_*, Alliance_* etc.
" - "Overrides Hidden and Open options when selected.") - hidden = models.BooleanField(default=True, - help_text="Group is hidden from users but can still join with the correct link.") - open = models.BooleanField(default=False, - help_text="Group is open and users will be automatically added upon request.
" - "If the group is not open users will need their request manually approved.") - public = models.BooleanField(default=False, - help_text="Group is public. Any registered user is able to join this group, with " - "visibility based on the other options set for this group.
Auth will " - "not remove users from this group automatically when they are no longer " - "authenticated.") + internal = models.BooleanField( + default=True, + help_text="Internal group, users cannot see, join or request to join this group.
" + "Used for groups such as Members, Corp_*, Alliance_* etc.
" + "Overrides Hidden and Open options when selected.", + ) + + hidden = models.BooleanField( + default=True, + help_text="Group is hidden from users but can still join with the correct link.", + ) + + open = models.BooleanField( + default=False, + help_text="Group is open and users will be automatically added upon request.
" + "If the group is not open users will need their request manually approved.", + ) + + public = models.BooleanField( + default=False, + help_text="Group is public. Any registered user is able to join this group, with " + "visibility based on the other options set for this group.
Auth will " + "not remove users from this group automatically when they are no longer " + "authenticated.", + ) + # Group leaders have management access to this group - group_leaders = models.ManyToManyField(User, related_name='leads_groups', blank=True, - help_text="Group leaders can process group requests for this group " - "specifically. Use the auth.group_management permission to allow " - "a user to manage all groups.") + group_leaders = models.ManyToManyField( + User, + related_name="leads_groups", + blank=True, + help_text="Group leaders can process group requests for this group " + "specifically. Use the auth.group_management permission to allow " + "a user to manage all groups.", + ) + # allow groups to be *group leads* - group_leader_groups = models.ManyToManyField(Group, related_name='leads_group_groups', blank=True, - help_text="Group leaders can process group requests for this group " - "specifically. Use the auth.group_management permission to allow " - "a user to manage all groups.") + group_leader_groups = models.ManyToManyField( + Group, + related_name="leads_group_groups", + blank=True, + help_text="Group leaders can process group requests for this group " + "specifically. Use the auth.group_management permission to allow " + "a user to manage all groups.", + ) - states = models.ManyToManyField(State, related_name='valid_states', blank=True, - help_text="States listed here will have the ability to join this group provided " - "they have the proper permissions.") + states = models.ManyToManyField( + State, + related_name="valid_states", + blank=True, + help_text="States listed here will have the ability to join this group provided " + "they have the proper permissions.", + ) - description = models.CharField(max_length=512, blank=True, help_text="Description of the group shown to users.") + description = models.TextField( + max_length=512, + null=True, + blank=True, + help_text="Short description (max. 512 characters) of the group shown to users.", + ) def __str__(self): return self.group.name class Meta: - permissions = ( - ("request_groups", u"Can request non-public groups"), - ) + permissions = (("request_groups", u"Can request non-public groups"),) default_permissions = tuple() diff --git a/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html b/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html index c2291f7f..0aa53fac 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html @@ -25,7 +25,7 @@ {% trans "Description" %} {% trans "Status" %} {% trans "Member Count" %} - + @@ -36,7 +36,7 @@ {{ group.name }} - {{ group.authgroup.description }} + {{ group.authgroup.description|linebreaks|urlize }} {% if group.authgroup.hidden %} @@ -64,7 +64,6 @@ - {% endfor %} diff --git a/allianceauth/groupmanagement/templates/groupmanagement/groups.html b/allianceauth/groupmanagement/templates/groupmanagement/groups.html index a94f4cd4..a577402c 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/groups.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/groups.html @@ -22,7 +22,7 @@ {% for g in groups %} {{ g.group.name }} - {{ g.group.authgroup.description|urlize }} + {{ g.group.authgroup.description|linebreaks|urlize }} {% if g.group in user.groups.all %} {% if not g.request %} diff --git a/allianceauth/groupmanagement/templates/groupmanagement/index.html b/allianceauth/groupmanagement/templates/groupmanagement/index.html index 138122e5..060a5670 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/index.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/index.html @@ -23,6 +23,7 @@
  • {% trans "Join Requests" %} + {% if acceptrequests %} {{ acceptrequests|length }} {% endif %} @@ -31,6 +32,7 @@
  • {% trans "Leave Requests" %} + {% if leaverequests %} {{ leaverequests|length }} {% endif %} @@ -131,7 +133,7 @@
    {{ leaverequest.main_char.alliance_name|default_if_none:"" }} {% else %} - (unknown) + {% trans "(unknown)" %} {% endif %} {{ leaverequest.group.name }}