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

Merge branch '1-GET_auto_author' into 'master'

Resolve "I can't display the author's name of a job-offer"

Closes #1

See merge request !4
parents 08297756 5d06fd5d
Pipeline #2817 passed with stage
in 27 seconds
......@@ -3,6 +3,7 @@ from .models import JobOffer
from django.contrib.auth.models import User
from django.db.models.signals import post_save
@factory.django.mute_signals(post_save)
class JobOfferFactory(factory.django.DjangoModelFactory):
class Meta:
......
from django.contrib.auth.models import User
from django.db import models
from djangoldp.models import Model
from djangoldp_skill.models import Skill
class JobOffer(models.Model):
class JobOffer(Model):
author = models.ForeignKey(User, on_delete=models.CASCADE)
title = models.CharField(max_length=255, blank=True, null=True)
description = models.CharField(max_length=255, blank=True, null=True)
......@@ -14,10 +15,8 @@ class JobOffer(models.Model):
class Meta:
auto_author = 'author'
permissions = (
('view_joboffer', 'Read'),
('control_joboffer', 'Control'),
)
nested_fields = ["skills"]
container_path = 'job-offers/'
def __str__(self):
return '{} ({})'.format(self.title, self.author.get_full_name())
"""djangoldp joboffer URL Configuration"""
from django.conf.urls import url
from djangoldp.views import LDPViewSet
from .models import JobOffer
urlpatterns = [
url(r'^job-offers/', LDPViewSet.urls(model=JobOffer, nested_fields=["skills"])),
]
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