Skip to content

Commit 914d3e3

Browse files
committed
refin the models
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 732a30d commit 914d3e3

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

aboutcode/notifications/models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class AbstractWebhookSubscription(models.Model):
4747

4848
class Meta:
4949
abstract = True
50-
ordering = ["-created_date"]
5150

5251
def get_payload(self, context):
5352
raise NotImplementedError
@@ -148,7 +147,6 @@ class Meta:
148147
abstract = True
149148
verbose_name = _("webhook delivery")
150149
verbose_name_plural = _("webhook deliveries")
151-
ordering = ["-sent_date"]
152150

153151
def __str__(self):
154152
return f"Webhook uuid={self.uuid} posted at {self.sent_date}"

notification/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ class WebhookSubscription(DataspacedModel, AbstractWebhookSubscription):
5252

5353
objects = WebhookSubscriptionQuerySet.as_manager()
5454

55-
class Meta(AbstractWebhookSubscription.Meta):
55+
class Meta:
5656
unique_together = ("dataspace", "uuid")
57+
ordering = ["-created_date"]
5758

5859
def __str__(self):
5960
return f"{self.event} => {self.target_url}"
@@ -125,6 +126,7 @@ class WebhookDelivery(DataspacedModel, AbstractWebhookDelivery):
125126

126127
class Meta(AbstractWebhookDelivery.Meta):
127128
unique_together = [("dataspace", "uuid")]
129+
ordering = ["-sent_date"]
128130

129131

130132
def fire_webhooks(

0 commit comments

Comments
 (0)