Commit abdcd589 authored by Jean-Baptiste's avatar Jean-Baptiste

update: send activity on new job offer

parent da3903e5
Pipeline #5089 passed with stage
in 27 seconds
from django import db
from django.conf import settings
from django.db import models
from djangoldp_conversation.models import Conversation
......@@ -24,6 +25,12 @@ class JobOffer(Model):
container_path = 'job-offers/'
rdf_type = 'hd:joboffer'
def content(self):
content = "{}\n\n{}\n\n".format(self.title, self.description)
for skill in self.skills.all():
content = "{} #{}".format(content,
return content
def __str__(self):
return '{} ({})'.format(self.title,
......@@ -40,8 +47,12 @@ try:
def on_follower(sender, instance, **kwargs):
if not instance.confirmed:
actor_url = urlparse(instance.local_id)
model = Model.resolve_id(actor_url.path)
if isinstance(model, JobOffer):
model, obj = Model.resolve(actor_url.path)
if model == JobOffer:
@receiver(post_save, sender=JobOffer)
def on_job_offer(sender, instance, **kwargs):
AP.create_activity(AP.note(JobOffer, instance))
except ModuleNotFoundError:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment