Build-in translations to privacy choices dropdwon
This commit is contained in:
@ -203,9 +203,12 @@ class UsernameField(ActivitypubFieldMixin, models.CharField):
|
||||
return value.split("@")[0]
|
||||
|
||||
|
||||
PrivacyLevels = models.TextChoices(
|
||||
"Privacy", ["public", "unlisted", "followers", "direct"]
|
||||
)
|
||||
PrivacyLevels = [
|
||||
("public", _("Public")),
|
||||
("unlisted", _("Unlisted")),
|
||||
("followers", _("Followers")),
|
||||
("direct", _("Private")),
|
||||
]
|
||||
|
||||
|
||||
class PrivacyField(ActivitypubFieldMixin, models.CharField):
|
||||
@ -214,9 +217,7 @@ class PrivacyField(ActivitypubFieldMixin, models.CharField):
|
||||
public = "https://www.w3.org/ns/activitystreams#Public"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(
|
||||
*args, max_length=255, choices=PrivacyLevels.choices, default="public"
|
||||
)
|
||||
super().__init__(*args, max_length=255, choices=PrivacyLevels, default="public")
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def set_field_from_activity(self, instance, data, overwrite=True):
|
||||
|
@ -40,9 +40,7 @@ class ImportJob(models.Model):
|
||||
mappings = models.JSONField()
|
||||
complete = models.BooleanField(default=False)
|
||||
source = models.CharField(max_length=100)
|
||||
privacy = models.CharField(
|
||||
max_length=255, default="public", choices=PrivacyLevels.choices
|
||||
)
|
||||
privacy = models.CharField(max_length=255, default="public", choices=PrivacyLevels)
|
||||
retry = models.BooleanField(default=False)
|
||||
|
||||
@property
|
||||
|
@ -129,7 +129,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||
related_name="favorite_statuses",
|
||||
)
|
||||
default_post_privacy = models.CharField(
|
||||
max_length=255, default="public", choices=fields.PrivacyLevels.choices
|
||||
max_length=255, default="public", choices=fields.PrivacyLevels
|
||||
)
|
||||
remote_id = fields.RemoteIdField(null=True, unique=True, activitypub_field="id")
|
||||
created_date = models.DateTimeField(auto_now_add=True)
|
||||
@ -427,7 +427,7 @@ class AnnualGoal(BookWyrmModel):
|
||||
goal = models.IntegerField(validators=[MinValueValidator(1)])
|
||||
year = models.IntegerField(default=get_current_year)
|
||||
privacy = models.CharField(
|
||||
max_length=255, default="public", choices=fields.PrivacyLevels.choices
|
||||
max_length=255, default="public", choices=fields.PrivacyLevels
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
Reference in New Issue
Block a user