diff --git a/djangoldp_circle/admin.py b/djangoldp_circle/admin.py index 181797acaf1dd4842a13bf532abe207360af0dfa..2c9a6eedfed04f74e611318091cf914c333394bd 100644 --- a/djangoldp_circle/admin.py +++ b/djangoldp_circle/admin.py @@ -1,7 +1,7 @@ from django.contrib import admin from djangoldp.admin import DjangoLDPAdmin from djangoldp.models import Model -from .models import Circle, CircleMember +from .models import Circle, CircleMember, CircleAccessRequest class EmptyAdmin(admin.ModelAdmin): @@ -15,12 +15,25 @@ class TeamInline(admin.TabularInline): extra = 0 +class CircleAccessRequestAdmin(DjangoLDPAdmin): + list_display = ('urlid', 'user', 'circle', 'status') + exclude = ('urlid', 'is_backlink', 'allow_create_backlink') + search_fields = ['urlid', 'user__urlid', 'circle__urlid', 'circle__name'] + ordering = ['urlid'] + + +class CircleAccessRequestInline(admin.TabularInline): + model = CircleAccessRequest + exclude = ('urlid', 'is_backlink', 'allow_create_backlink') + extra = 0 + + class CircleAdmin(DjangoLDPAdmin): list_display = ('urlid', 'name', 'owner', 'status', 'jabberID') exclude = ('urlid', 'is_backlink', 'allow_create_backlink', 'jabberID', 'jabberRoom') search_fields = ['urlid', 'name', 'members__user__urlid', 'subtitle', 'description', 'status', 'owner__urlid'] ordering = ['urlid'] - inlines = [TeamInline] + inlines = [TeamInline, CircleAccessRequestInline] def get_queryset(self, request): # Hide distant circles @@ -31,3 +44,4 @@ class CircleAdmin(DjangoLDPAdmin): admin.site.register(CircleMember, EmptyAdmin) admin.site.register(Circle, CircleAdmin) +admin.site.register(CircleAccessRequest, CircleAccessRequestAdmin) diff --git a/djangoldp_circle/locale/de/LC_MESSAGES/django.po b/djangoldp_circle/locale/de/LC_MESSAGES/django.po index 35fe518774b278465ebfeac2ef3f91e5047c9108..cadfca2cad0a4dfa0b1348ec81330fa03b16e395 100644 --- a/djangoldp_circle/locale/de/LC_MESSAGES/django.po +++ b/djangoldp_circle/locale/de/LC_MESSAGES/django.po @@ -19,15 +19,15 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: models.py:260 -msgid "Someone requested access to your circle" +msgid "Someone requested access to your space" msgstr "" #: models.py:280 -msgid "Your access request has been accepted" +msgid "Your access request has been accepted on the space" msgstr "" #: models.py:280 -msgid "Your access request has been refused" +msgid "Your access request has been refused on the space" msgstr "" #: models.py:282 @@ -39,15 +39,15 @@ msgid "Auteur inconnu" msgstr "" #: models.py:306 -msgid "New Circle access request" +msgid "New Space access request" msgstr "" #: models.py:306 -msgid "Circle access request" +msgid "Space access request" msgstr "" #: templates/accessrequests/access_requested.html:5 -msgid "requested access to your circle:" +msgid "requested access to your space:" msgstr "" #: templates/accessrequests/access_requested.html:11 @@ -61,7 +61,7 @@ msgid "Instead, find the request at" msgstr "" #: templates/accessrequests/access_resolved.html:5 -msgid "Your request to access the circle" +msgid "Your request to access the space" msgstr "" #: templates/accessrequests/access_resolved.html:5 diff --git a/djangoldp_circle/locale/en/LC_MESSAGES/django.mo b/djangoldp_circle/locale/en/LC_MESSAGES/django.mo index 471d3b50c22d83473a314115ba2b4f5511332381..8a02d125ff49800db8841b2efc18bb09bf62bb5c 100644 Binary files a/djangoldp_circle/locale/en/LC_MESSAGES/django.mo and b/djangoldp_circle/locale/en/LC_MESSAGES/django.mo differ diff --git a/djangoldp_circle/locale/en/LC_MESSAGES/django.po b/djangoldp_circle/locale/en/LC_MESSAGES/django.po index bcc4431dc7d21f86fb8f4574709c9da93659cda4..42a3ebe084b42b9c64916ac88175a94e5609c655 100644 --- a/djangoldp_circle/locale/en/LC_MESSAGES/django.po +++ b/djangoldp_circle/locale/en/LC_MESSAGES/django.po @@ -19,32 +19,32 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: models.py:260 -msgid "Someone requested access to your circle" -msgstr "Someone requested access to your circle" +msgid "Someone requested access to your space" +msgstr "Someone requested access to your space" #: models.py:280 -msgid "Your access request has been accepted" -msgstr "Your access request has been accepted" +msgid "Your access request has been accepted on the space" +msgstr "Your access request has been accepted on the space" #: models.py:280 -msgid "Your access request has been refused" -msgstr "Your access request has been refused" +msgid "Your access request has been refused on the space" +msgstr "Your access request has been refused on the space" #: models.py:305 msgid "Auteur inconnu" msgstr "Unknown author" #: models.py:306 -msgid "New Circle access request" -msgstr "New Circle access request" +msgid "New Space access request" +msgstr "New Space access request" #: models.py:306 -msgid "Circle access request" -msgstr "Circle access request" +msgid "Space access request" +msgstr "Space access request" #: templates/accessrequests/access_requested.html:5 -msgid "requested access to your circle:" -msgstr "requested access to your circle:" +msgid "requested access to your space:" +msgstr "requested access to your space:" #: templates/accessrequests/access_requested.html:11 #: templates/accessrequests/access_resolved.html:11 @@ -57,8 +57,8 @@ msgid "Instead, find the request at" msgstr "Instead, find the request at" #: templates/accessrequests/access_resolved.html:5 -msgid "Your request to access the circle" -msgstr "Your request to access the circle" +msgid "Your request to access the space" +msgstr "Your request to access the space" #: templates/accessrequests/access_resolved.html:5 msgid "has been" diff --git a/djangoldp_circle/locale/es/LC_MESSAGES/django.po b/djangoldp_circle/locale/es/LC_MESSAGES/django.po index 35fe518774b278465ebfeac2ef3f91e5047c9108..cadfca2cad0a4dfa0b1348ec81330fa03b16e395 100644 --- a/djangoldp_circle/locale/es/LC_MESSAGES/django.po +++ b/djangoldp_circle/locale/es/LC_MESSAGES/django.po @@ -19,15 +19,15 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: models.py:260 -msgid "Someone requested access to your circle" +msgid "Someone requested access to your space" msgstr "" #: models.py:280 -msgid "Your access request has been accepted" +msgid "Your access request has been accepted on the space" msgstr "" #: models.py:280 -msgid "Your access request has been refused" +msgid "Your access request has been refused on the space" msgstr "" #: models.py:282 @@ -39,15 +39,15 @@ msgid "Auteur inconnu" msgstr "" #: models.py:306 -msgid "New Circle access request" +msgid "New Space access request" msgstr "" #: models.py:306 -msgid "Circle access request" +msgid "Space access request" msgstr "" #: templates/accessrequests/access_requested.html:5 -msgid "requested access to your circle:" +msgid "requested access to your space:" msgstr "" #: templates/accessrequests/access_requested.html:11 @@ -61,7 +61,7 @@ msgid "Instead, find the request at" msgstr "" #: templates/accessrequests/access_resolved.html:5 -msgid "Your request to access the circle" +msgid "Your request to access the space" msgstr "" #: templates/accessrequests/access_resolved.html:5 diff --git a/djangoldp_circle/locale/fr/LC_MESSAGES/django.mo b/djangoldp_circle/locale/fr/LC_MESSAGES/django.mo index 7ee30b008ae4505890e338bd63866e969e237c2c..d64274fa33edc1b70d9e82025418164008be24e9 100644 Binary files a/djangoldp_circle/locale/fr/LC_MESSAGES/django.mo and b/djangoldp_circle/locale/fr/LC_MESSAGES/django.mo differ diff --git a/djangoldp_circle/locale/fr/LC_MESSAGES/django.po b/djangoldp_circle/locale/fr/LC_MESSAGES/django.po index b3270e55a351b4462206f533046c0ce04c3048c6..5e735ca448d91655c95c02319b62ca6358443e27 100644 --- a/djangoldp_circle/locale/fr/LC_MESSAGES/django.po +++ b/djangoldp_circle/locale/fr/LC_MESSAGES/django.po @@ -19,32 +19,32 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: models.py:260 -msgid "Someone requested access to your circle" -msgstr "Quelqu'un a demandé l'accès à votre cercle" +msgid "Someone requested access to your space" +msgstr "Quelqu'un a demandé l'accès à votre espace" #: models.py:280 -msgid "Your access request has been accepted" -msgstr "Votre demande d'accès a été accepté" +msgid "Your access request has been accepted on the space" +msgstr "Votre demande d'accès a été accepté à l'espace" #: models.py:280 -msgid "Your access request has been refused" -msgstr "Votre demande d'accès a été refusé" +msgid "Your access request has been refused on the space" +msgstr "Votre demande d'accès a été refusé à l'espace" #: models.py:305 msgid "Auteur inconnu" msgstr "Auteur inconnu" #: models.py:306 -msgid "New Circle access request" -msgstr "Nouvelle demande d'accès à un cercle" +msgid "New Space access request" +msgstr "Nouvelle demande d'accès à un espace" #: models.py:306 -msgid "Circle access request" -msgstr "Demande d'accès à un cercle" +msgid "Space access request" +msgstr "Demande d'accès à un espace" #: templates/accessrequests/access_requested.html:5 -msgid "requested access to your circle:" -msgstr "a demandé l'accès à votre cercle: " +msgid "requested access to your space:" +msgstr "a demandé l'accès à votre espace: " #: templates/accessrequests/access_requested.html:11 #: templates/accessrequests/access_resolved.html:11 @@ -57,8 +57,8 @@ msgid "Instead, find the request at" msgstr "A la place, vous pouvez retrouver la demande sur" #: templates/accessrequests/access_resolved.html:5 -msgid "Your request to access the circle" -msgstr "Votre demande d'accès au cercle" +msgid "Your request to access the space" +msgstr "Votre demande d'accès au espace" #: templates/accessrequests/access_resolved.html:5 msgid "has been" diff --git a/djangoldp_circle/models.py b/djangoldp_circle/models.py index 1a1800a1d4900e0f548e07da16d7da359de70716..bb63556eaf41c8926a629b9f55257f24cd63509b 100644 --- a/djangoldp_circle/models.py +++ b/djangoldp_circle/models.py @@ -159,6 +159,9 @@ class CircleAccessRequest(Model): authenticated_perms = ['add'] owner_perms = ['add'] rdf_type = 'hd:circleaccessrequest' + + def __str__(self): + return '{} requests access to {}'.format(self.user.urlid, self.circle.urlid) @receiver(post_save, sender=CircleMember) @@ -262,7 +265,7 @@ if 'djangoldp_notification' in settings.DJANGOLDP_PACKAGES: }) send_mail( - _("Someone requested access to your circle"), + _("Someone requested access to your space"), to_text(html_message), email_from, [instance.user.email], @@ -282,7 +285,8 @@ if 'djangoldp_notification' in settings.DJANGOLDP_PACKAGES: } ) - email_title = (ar.status == "Accepted") if _("Your access request has been accepted") else _("Your access request has been refused") + email_title = _("Your access request has been accepted on the space") if (ar.status == "Accepted") else _("Your access request has been refused on the space") + email_title = email_title + (ar.circle.name if ar.circle.name is not None else ar.circle.urlid) send_mail( email_title, to_text(html_message), @@ -308,9 +312,10 @@ if 'djangoldp_notification' in settings.DJANGOLDP_PACKAGES: notification_type = "CircleAccessRequest" author = instance.user if created else instance.responded_to_by author = author.urlid if author is not None else str(_("Auteur inconnu")) - summary = (instance.status == "Accepted") if _("Your access request has been accepted") else _("Your access request has been refused") + summary = _("Your access request has been accepted on the space") if (instance.status == "Accepted") else _("Your access request has been refused on the space") + summary = summary + (instance.circle.name if instance.circle.name is not None else instance.circle.urlid) if created: - summary = _('New Circle access request') + summary = _('New Space access request') notification = { "@context": settings.LDP_RDF_CONTEXT, diff --git a/djangoldp_circle/templates/accessrequests/access_requested.html b/djangoldp_circle/templates/accessrequests/access_requested.html index 69d7f5b9b62e812694e9caba807547bf624e7794..096aa9d7c9fafb56dfc31ecd44f68fced655d671 100644 --- a/djangoldp_circle/templates/accessrequests/access_requested.html +++ b/djangoldp_circle/templates/accessrequests/access_requested.html @@ -2,7 +2,7 @@ <!DOCTYPE html> <html> <div> - {%if instance.user.name is not None %}{{instance.user.name}}{% else %}{{instance.user.urlid}}{% endif %} {% trans "requested access to your circle:" %} {{instance.circle.name}} + {%if instance.user.name is not None %}{{instance.user.name}}{% else %}{{instance.user.urlid}}{% endif %} {% trans "requested access to your space:" %} {{instance.circle.name}} </div> <div style='margin-top:10px;'> <p style='font-size:small;color:#777'> diff --git a/djangoldp_circle/templates/accessrequests/access_resolved.html b/djangoldp_circle/templates/accessrequests/access_resolved.html index 15785c237470db5ed7acddfe3907426f1bef93e3..4c6b9fa9c711dac2411c6f5d225c2421e433c651 100644 --- a/djangoldp_circle/templates/accessrequests/access_resolved.html +++ b/djangoldp_circle/templates/accessrequests/access_resolved.html @@ -2,7 +2,7 @@ <!DOCTYPE html> <html> <div> - {%trans "Your request to access the circle" %} {{instance.circle.name}} {%trans "has been" %} {% if accepted %}{%trans "accepted" %}{% else %}{%trans "denied" %}{% endif %}. + {%trans "Your request to access the space" %} {{instance.circle.name}} {%trans "has been" %} {% if accepted %}{%trans "accepted" %}{% else %}{%trans "denied" %}{% endif %}. </div> <div style='margin-top:10px;'> <p style='font-size:small;color:#777'>