Commit ff611125 authored by Sylvain Le Bon's avatar Sylvain Le Bon

Merge branch 'jbpasquier/virtualcontainer' into 'master'

feature: virtual container for current, expired, self or owned offers

See merge request !7
parents d0f368da d8268cb5
Pipeline #4057 passed with stage
in 27 seconds
from django.conf.urls import url
from .views import JobOffersViewset, JobOffersCurrentViewset, \
JobOffersExpiredViewset
urlpatterns = [
url(r'^job-offers/current/', JobOffersCurrentViewset.urls()),
url(r'^job-offers/expired/', JobOffersExpiredViewset.urls()),
# Dirty fix for bad id change to job-offers/self/
url(r'^job-offers/', JobOffersViewset.urls()),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-18 09:46
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('djangoldp_joboffer', '0004_joboffer_conversation'),
]
operations = [
migrations.AlterField(
model_name='joboffer',
name='author',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='jobOffers', to=settings.AUTH_USER_MODEL),
),
]
......@@ -7,7 +7,7 @@ from djangoldp_skill.models import Skill
class JobOffer(Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
author = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='jobOffers', on_delete=models.CASCADE)
title = models.CharField(max_length=255)
description = models.TextField()
skills = models.ManyToManyField(Skill)
......
USER_NESTED_FIELDS = ['jobOffers']
\ No newline at end of file
from djangoldp.views import LDPViewSet
from datetime import datetime
from .models import JobOffer
class JobOffersCurrentViewset(LDPViewSet):
model = JobOffer
def get_queryset(self):
return super().get_queryset() \
.filter(closingDate__gte=datetime.now())
class JobOffersExpiredViewset(LDPViewSet):
model = JobOffer
def get_queryset(self):
return super().get_queryset() \
.filter(closingDate__lte=datetime.now())
# Dirty fix for bad id change to job-offers/self/
class JobOffersViewset(LDPViewSet):
model = JobOffer
def get_queryset(self):
return super().get_queryset()
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