mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 01:12:08 +01:00 
			
		
		
		
	Linting
This commit is contained in:
		@@ -251,7 +251,7 @@ class ProfileTrustView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
 | 
			
		||||
    model = User
 | 
			
		||||
    template_name = 'member/profile_trust.html'
 | 
			
		||||
    context_object_name = 'user_object'
 | 
			
		||||
    extra_context = {"title":_("Note friendships")}
 | 
			
		||||
    extra_context = {"title": _("Note friendships")}
 | 
			
		||||
 | 
			
		||||
    def get_context_data(self, **kwargs):
 | 
			
		||||
        context = super().get_context_data(**kwargs)
 | 
			
		||||
@@ -262,20 +262,21 @@ class ProfileTrustView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
 | 
			
		||||
            trusting=context["object"].note,
 | 
			
		||||
            trusted=context["object"].note
 | 
			
		||||
        ))
 | 
			
		||||
        context["widget"] = {"name": "trusted",
 | 
			
		||||
            "attrs": { "model_pk": ContentType.objects.get_for_model(Alias).pk,
 | 
			
		||||
        context["widget"] = {
 | 
			
		||||
            "name": "trusted",
 | 
			
		||||
            "attrs": {
 | 
			
		||||
                "model_pk": ContentType.objects.get_for_model(Alias).pk,
 | 
			
		||||
                "class": "autocomplete form-control",
 | 
			
		||||
                "id": "trusted",
 | 
			
		||||
                "resetable": True,
 | 
			
		||||
                "api_url": "/api/note/alias/?note__polymorphic_ctype__model=noteuser",
 | 
			
		||||
                "name_field": "name",
 | 
			
		||||
                "placeholder": ""
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return context
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ProfileAliasView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
 | 
			
		||||
    """
 | 
			
		||||
    View and manage user aliases.
 | 
			
		||||
 
 | 
			
		||||
@@ -67,8 +67,8 @@ class TrustViewSet(ReadProtectedModelViewSet):
 | 
			
		||||
    serializer_class = TrustSerializer
 | 
			
		||||
    filter_backends = [SearchFilter, DjangoFilterBackend, OrderingFilter]
 | 
			
		||||
    search_fields = ['$trusting__alias__name', '$trusting__alias__normalized_name',
 | 
			
		||||
            '$trusted__alias__name', '$trusted__alias__normalized_name']
 | 
			
		||||
    filterset_fields = ['trusting', 'trusting__noteuser__user', 'trusted', 'trusted__noteuser__user',]
 | 
			
		||||
                     '$trusted__alias__name', '$trusted__alias__normalized_name']
 | 
			
		||||
    filterset_fields = ['trusting', 'trusting__noteuser__user', 'trusted', 'trusted__noteuser__user']
 | 
			
		||||
    ordering_fields = ['trusting', 'trusted', ]
 | 
			
		||||
 | 
			
		||||
    def get_serializer_class(self):
 | 
			
		||||
 
 | 
			
		||||
@@ -244,6 +244,10 @@ class Trust(models.Model):
 | 
			
		||||
        verbose_name_plural = _("friendships")
 | 
			
		||||
        unique_together = ("trusting", "trusted")
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return _("Friendship between {trusting} and{trusted}").format(
 | 
			
		||||
            trusting=str(self.trusting), trusted=str(self.trusted))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Alias(models.Model):
 | 
			
		||||
    """
 | 
			
		||||
 
 | 
			
		||||
@@ -161,12 +161,16 @@ class TrustTable(tables.Table):
 | 
			
		||||
    show_header = False
 | 
			
		||||
    trusted = tables.Column(attrs={'td': {'class': 'text_center'}})
 | 
			
		||||
 | 
			
		||||
    delete_col = tables.TemplateColumn(template_code=DELETE_TEMPLATE,
 | 
			
		||||
            extra_context={"delete_trans": _('delete')},
 | 
			
		||||
            attrs={'td': {'class': lambda record: 'col-sm-1' + (' d-none'
 | 
			
		||||
                if not PermissionBackend.check_perm(get_current_request(),
 | 
			
		||||
                    "note.delete_trust", record) else '')}},
 | 
			
		||||
            verbose_name =_("Delete"), )
 | 
			
		||||
    delete_col = tables.TemplateColumn(
 | 
			
		||||
        template_code=DELETE_TEMPLATE,
 | 
			
		||||
        extra_context={"delete_trans": _('delete')},
 | 
			
		||||
        attrs={
 | 
			
		||||
            'td': {
 | 
			
		||||
                'class': lambda record: 'col-sm-1'
 | 
			
		||||
                + (' d-none' if not PermissionBackend.check_perm(
 | 
			
		||||
                    get_current_request(), "note.delete_trust", record)
 | 
			
		||||
                   else '')}},
 | 
			
		||||
        verbose_name=_("Delete"),)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AliasTable(tables.Table):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user