Skip to content

Commit d908ec1

Browse files
committed
Disable twitter publication of job offer due to Twitter API restrictions
1 parent 6a6c070 commit d908ec1

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

apps/jobs/models.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,10 @@
3838
class ActiveJobOfferManager(models.Manager):
3939
def get_queryset(self):
4040
today = datetime.date.today()
41-
return (
42-
super()
43-
.get_queryset()
44-
.filter(approved=True)
45-
.filter(valid_until__gte=today)
46-
)
41+
return super().get_queryset().filter(approved=True).filter(valid_until__gte=today)
4742

4843

4944
class JobOffer(models.Model):
50-
5145
objects = models.Manager() # The default manager.
5246
actives = ActiveJobOfferManager() # Only the active jobs offer
5347

@@ -59,9 +53,7 @@ class Meta:
5953
employer = models.CharField("Ofertante", max_length=120)
6054
title = models.CharField("Nombre del puesto", max_length=220)
6155
description = models.TextField("Texto de la oferta", max_length=2000)
62-
salary = models.CharField(
63-
"Salario o rango salarial", max_length=80, blank=True
64-
)
56+
salary = models.CharField("Salario o rango salarial", max_length=80, blank=True)
6557
contract_type = models.CharField(
6658
"Tipo de contrato",
6759
max_length=3,
@@ -108,6 +100,7 @@ def save(self, *args, **kwargs):
108100
already_exists = self.pk is not None
109101
super().save(*args, **kwargs)
110102
if not already_exists and self.approved:
111-
t = Twitter()
103+
# tweepy.error.TweepError: [{'message': 'You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product', 'code': 453}]
104+
# t = Twitter()
112105
msg = f'💼 Oferta de empleo: {self} {self.get_full_url()}'
113106
t.post(msg)

0 commit comments

Comments
 (0)