Block or approve domains
This commit is contained in:
parent
6b0967df39
commit
f0ae37c331
5 changed files with 49 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
|||
""" outlink data """
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
@ -62,6 +63,11 @@ class LinkDomain(BookWyrmModel):
|
|||
status = models.CharField(max_length=50, choices=StatusChoices, default="pending")
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
def raise_not_editable(self, viewer):
|
||||
if viewer.has_perm("moderate_post"):
|
||||
return
|
||||
raise PermissionDenied()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
"""set a default name"""
|
||||
if not self.name:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue