make description a real description

textfield instead of charfield. a bit more user friendly in the backend
This commit is contained in:
Peter Pfeufer 2020-10-25 12:16:09 +01:00
parent 87c0c3ac73
commit 603bd9c37c
No known key found for this signature in database
GPG Key ID: 6051D2C6AD4EBC27
5 changed files with 87 additions and 35 deletions

View File

@ -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 <i>(max. 512 characters)</i> of the group shown to users.",
max_length=512,
null=True,
),
),
]

View File

@ -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.<br>"
"Used for groups such as Members, Corp_*, Alliance_* etc.<br>"
"<b>Overrides Hidden and Open options when selected.</b>")
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. <br>"
"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.<br> 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.<br>"
"Used for groups such as Members, Corp_*, Alliance_* etc.<br>"
"<b>Overrides Hidden and Open options when selected.</b>",
)
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. <br>"
"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.<br> 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 <i>(max. 512 characters)</i> 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()

View File

@ -25,7 +25,7 @@
<th>{% trans "Description" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Member Count" %}</th>
<th></th>
<th style="min-width: 170px;"></th>
</tr>
</thead>
@ -36,7 +36,7 @@
<a href="{% url 'groupmanagement:membership' group.id %}">{{ group.name }}</a>
</td>
<td>{{ group.authgroup.description }}</td>
<td>{{ group.authgroup.description|linebreaks|urlize }}</td>
<td>
{% if group.authgroup.hidden %}
@ -64,7 +64,6 @@
<a id="clipboard-copy" data-clipboard-text="{{ request.scheme }}://{{request.get_host}}{% url 'groupmanagement:request_add' group.id %}" class="btn btn-warning" title="{% trans "Copy Direct Join Link" %}">
<i class="glyphicon glyphicon-copy"></i>
</a>
</td>
</tr>
{% endfor %}

View File

@ -22,7 +22,7 @@
{% for g in groups %}
<tr>
<td>{{ g.group.name }}</td>
<td>{{ g.group.authgroup.description|urlize }}</td>
<td>{{ g.group.authgroup.description|linebreaks|urlize }}</td>
<td class="text-right">
{% if g.group in user.groups.all %}
{% if not g.request %}

View File

@ -23,6 +23,7 @@
<li class="active">
<a data-toggle="tab" href="#add">
{% trans "Join Requests" %}
{% if acceptrequests %}
<span class="badge">{{ acceptrequests|length }}</span>
{% endif %}
@ -31,6 +32,7 @@
<li>
<a data-toggle="tab" href="#leave">
{% trans "Leave Requests" %}
{% if leaverequests %}
<span class="badge">{{ leaverequests|length }}</span>
{% endif %}
@ -131,7 +133,7 @@
</a><br>
{{ leaverequest.main_char.alliance_name|default_if_none:"" }}
{% else %}
(unknown)
{% trans "(unknown)" %}
{% endif %}
</td>
<td>{{ leaverequest.group.name }}</td>