Add more sortable fields
This commit is contained in:
parent
c75efbc8a6
commit
bb33a346f6
@ -195,7 +195,7 @@ class Subscription_ListView(generics.ListCreateAPIView):
|
||||
"article_title_mutators", "article_desc_mutators", "embed_colour", "published_threshold", "active"
|
||||
]
|
||||
search_fields = ["name", "url", "extra_notes"]
|
||||
ordering_fields = ["creation_datetime", "channels_count"]
|
||||
ordering_fields = ["name", "creation_datetime", "active"]
|
||||
|
||||
read_serializer_class = SubscriptionSerializer_GET
|
||||
write_serializer_class = SubscriptionSerializer_POST
|
||||
@ -489,7 +489,7 @@ class TrackedContent_ListView(generics.ListCreateAPIView):
|
||||
filter_backends = [filters.SearchFilter, rest_filters.DjangoFilterBackend, filters.OrderingFilter]
|
||||
filterset_fields = ["guid", "title", "url", "subscription", "subscription__guild_id", "channel_id", "blocked", "creation_datetime"]
|
||||
search_fields = ["guid", "title", "url", "subscription__name", "subscription__url"]
|
||||
ordering_fields = ["creation_datetime"]
|
||||
ordering_fields = ["title", "subscription", "creation_datetime", "blocked"]
|
||||
|
||||
read_serializer_class = TrackedContentSerializer_GET
|
||||
write_serializer_class = TrackedContentSerializer_POST
|
||||
|
@ -221,27 +221,31 @@ class Subscription(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
||||
name = models.CharField(
|
||||
_("Name"),
|
||||
max_length=32,
|
||||
null=False,
|
||||
blank=False
|
||||
)
|
||||
|
||||
url = models.URLField()
|
||||
url = models.URLField(_("URL"))
|
||||
|
||||
# NOTE:
|
||||
# Have to use charfield instead of positiveBigIntegerField due to an Sqlite
|
||||
# issue that rounds down the value
|
||||
# https://github.com/sequelize/sequelize/issues/9335
|
||||
guild_id = models.CharField(
|
||||
_("Guild ID"),
|
||||
max_length=128
|
||||
)
|
||||
|
||||
creation_datetime = models.DateTimeField(
|
||||
_("Created At"),
|
||||
default=timezone.now,
|
||||
editable=False
|
||||
)
|
||||
|
||||
extra_notes = models.CharField(
|
||||
_("Extra Notes"),
|
||||
max_length=250,
|
||||
null=True,
|
||||
blank=True,
|
||||
@ -262,19 +266,21 @@ class Subscription(models.Model):
|
||||
)
|
||||
|
||||
embed_colour = models.CharField(
|
||||
_("Embed Colour"),
|
||||
max_length=6,
|
||||
default="3498db",
|
||||
blank=True
|
||||
)
|
||||
|
||||
published_threshold = models.DateTimeField(default=timezone.now, blank=True)
|
||||
published_threshold = models.DateTimeField(_("Published Threshold"), default=timezone.now, blank=True)
|
||||
|
||||
article_fetch_image = models.BooleanField(
|
||||
_("Fetch Article Images"),
|
||||
default=True,
|
||||
help_text="Will the resulting article have an image?"
|
||||
)
|
||||
|
||||
active = models.BooleanField(default=True)
|
||||
active = models.BooleanField(_("Active"), default=True)
|
||||
|
||||
class Meta:
|
||||
"""
|
||||
@ -314,23 +320,28 @@ class TrackedContent(models.Model):
|
||||
This is used to ensure duplicate articles aren't sent in feeds.
|
||||
"""
|
||||
|
||||
id = models.AutoField(primary_key=True)
|
||||
id = models.AutoField(_("ID"), primary_key=True)
|
||||
|
||||
guid = models.CharField(max_length=256)
|
||||
guid = models.CharField(
|
||||
_("GUID"),
|
||||
max_length=256,
|
||||
help_text=_("RSS provided GUID of the content")
|
||||
)
|
||||
|
||||
title = models.CharField(max_length=728)
|
||||
title = models.CharField(_("Title"), max_length=728)
|
||||
|
||||
url = models.URLField()
|
||||
url = models.URLField(_("URL"))
|
||||
|
||||
subscription = models.ForeignKey(to=Subscription, on_delete=models.CASCADE)
|
||||
|
||||
channel_id = models.CharField(max_length=128)
|
||||
channel_id = models.CharField(_("Channel ID"), max_length=128)
|
||||
|
||||
message_id = models.CharField(max_length=128)
|
||||
message_id = models.CharField(_("Message ID"), max_length=128)
|
||||
|
||||
blocked = models.BooleanField(default=False)
|
||||
blocked = models.BooleanField(_("Blocked"), default=False)
|
||||
|
||||
creation_datetime = models.DateTimeField(
|
||||
_("Created At"),
|
||||
default=timezone.now,
|
||||
editable=False
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user