Show the number of jobs available

Ting
Nov 27, 2020

category, tag{{% %}}, | filter

{{jobs | length}} to show the number of jobs posted.
{{jobs | length}} to show the number of jobs posted.
SeudoNet 2 jobs available

Method 2:

job/views.py: add key:value-> jobs_count
add to html template
o job situation
just show 50 context
show 30 words

add author on job detail page, after title:

job/detail.html

output:

add time
output
{{job_obj.title}}   ---> tag
{{job.content | truncatewords:30}} ---> tag | filter

Add a link for Category

job/urls.py: add path of ‘views. jobs_with_type’ -> job/views.py -> add method of ‘jobs_with_type’

  1. job/urls.py: add path of ‘views. jobs_with_type’
path(<pk>, route, nickname)

2. job/views.py: create method ‘jobs_with_type’

def job_with_type(request, job_type_pk):
return render(request,'‘jobs_with_type.html',conext)

then build the dict context:

then get_object_or_404()

# get_object_or_404(model, requirement: pk=(parameter) job_type_pk)

build key:value pair:

# object management; 1st job_type is attr of Model Job, 2nd job_type is the variable obtained just now.

3. build jobs_with_type.html

Click on the category link, leads to jobs_with_type.html page

--

--