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

update: send activity on new job offer

parent ffc9ea71
Pipeline #5087 passed with stage
in 27 seconds
......@@ -8,7 +8,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangoldp_conversation', '0003_auto_20190503_0323'),
('djangoldp_joboffer', '0003_auto_20190524_1432'),
]
......
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, skill.name)
return content
def __str__(self):
return '{} ({})'.format(self.title, self.author.get_full_name())
......@@ -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:
AP.accept(instance)
@receiver(post_save, sender=JobOffer)
def on_job_offer(sender, instance, **kwargs):
AP.create_activity(AP.note(JobOffer, instance))
except ModuleNotFoundError:
pass
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