Commit 563c1e6f authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

Revert "fix: better use of viewset"

This reverts commit 40eb1896.
parent 40eb1896
Pipeline #3779 passed with stage
in 28 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()),
]
from django.conf import settings
from django.db import models
from .views import JobOffersCurrentViewset
from djangoldp.models import Model
from djangoldp_skill.models import Skill
......@@ -16,7 +15,6 @@ class JobOffer(Model):
class Meta:
auto_author = 'author'
view_set = JobOffersCurrentViewset
nested_fields = ["skills"]
container_path = 'job-offers/'
rdf_type = 'hd:joboffer'
......
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())
\ No newline at end of file
.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