26# created update job view, template
This commit is contained in:
parent
7c113d729c
commit
4dfae071fb
@ -13,3 +13,10 @@ class ApplyJobForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Job
|
||||
fields = []
|
||||
|
||||
|
||||
class UpdateJobForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Job
|
||||
fields = ['title', 'company', 'location', 'job_type', 'category', 'description']
|
||||
widgets = {'job_type': forms.RadioSelect}
|
||||
|
@ -7,5 +7,7 @@ urlpatterns = [
|
||||
path('create-job/', CreateJobView.as_view(), name="create_job"),
|
||||
path('search/', SearchJobView.as_view(), name="search"),
|
||||
path('detail/<slug>/<int:pk>/', SingleJobView.as_view(), name="single_job"),
|
||||
path('update/<slug>/<int:pk>/', UpdateJobView.as_view(), name="update_job"),
|
||||
path('delete/<slug>/<int:pk>/', DeleteJobView.as_view(), name="delete_job"),
|
||||
path('category-detail/<slug>/<int:pk>/', CategoryDetailView.as_view(), name="category_detail"),
|
||||
]
|
||||
|
@ -4,9 +4,9 @@ from django.db.models import Q
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.urls import reverse
|
||||
from django.views.generic import TemplateView, ListView, CreateView, DetailView, UpdateView
|
||||
from django.views.generic import TemplateView, ListView, CreateView, DetailView, UpdateView, DeleteView
|
||||
|
||||
from jobs.forms import CreateJobForm, ApplyJobForm
|
||||
from jobs.forms import CreateJobForm, ApplyJobForm, UpdateJobForm
|
||||
from jobs.models import Job, Category
|
||||
|
||||
|
||||
@ -107,3 +107,13 @@ class SearchJobView(ListView):
|
||||
context['categories'] = Category.objects.all()
|
||||
return context
|
||||
|
||||
|
||||
class UpdateJobView(SuccessMessageMixin ,UpdateView):
|
||||
model = Job
|
||||
template_name = 'jobs/update.html'
|
||||
form_class = UpdateJobForm
|
||||
success_message = "You updated your job!"
|
||||
|
||||
|
||||
class DeleteJobView(SuccessMessageMixin, DeleteView):
|
||||
pass
|
||||
|
@ -53,6 +53,10 @@
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="tag-widget post-tag-container mb-5 mt-5">
|
||||
<a href="{% url 'jobs:delete_job' slug=job.slug pk=job.pk %}" class="btn btn-danger py-2 mr-1">Delete</a>
|
||||
<a href="{% url 'jobs:update_job' slug=job.slug pk=job.pk %}" class="btn btn-primary py-2 mr-1">Update</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div> <!-- .col-md-8 -->
|
||||
|
120
templates/jobs/update.html
Normal file
120
templates/jobs/update.html
Normal file
@ -0,0 +1,120 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
|
||||
<div class="hero-wrap js-fullheight" style="background-image: url('{% static 'images/bg_2.jpg' %}');" data-stellar-background-ratio="0.5"> <div class="overlay"></div>
|
||||
<div class="container">
|
||||
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
|
||||
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
|
||||
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Update a job</span></p>
|
||||
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Update a job</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ftco-section bg-light">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 col-lg-8 mb-5">
|
||||
{% if user.is_employer %}
|
||||
<form action="#" class="p-5 bg-white" method="post">
|
||||
{% csrf_token %}
|
||||
{% if form.errors %}
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<div id="form_errors">
|
||||
{% for key, value in form.errors.items %}
|
||||
<span class="fieldWrapper">
|
||||
{{ key }}: {{ value }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<button type="button" class="close" data-dismiss="alert" aria_hidden="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% for field in form.visible_fields|slice:"3" %}
|
||||
<div class="row form-group">
|
||||
<div class="col-md-12 mb-3 mb-md-0">
|
||||
<label class="font-weight-bold" for="fullname">{{ field.label }}</label>
|
||||
<input type="{{ field.field.widget.input_type }}" id="fullname" class="form-control" value="{{ field.value }}" name="{{ field.html_name }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-md-12">
|
||||
<label class="font-weight-bold" for="fullname">Job type</label>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3 mb-md-0">
|
||||
<label for="option-job-type-1">
|
||||
{{ form.job_type }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-md-12">
|
||||
<label class="font-weight-bold" for="fullname">Category</label>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3 mb-md-0">
|
||||
<label for="option-job-type-1">
|
||||
{{ form.category }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-md-12">
|
||||
<label class="font-weight-bold" for="fullname">Description</label>
|
||||
</div>
|
||||
{{ form.media }}
|
||||
{{ form.description }}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-md-12">
|
||||
<input type="submit" value="Update" class="btn btn-primary py-2 px-5">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{% else %}
|
||||
<div class="row form-group">
|
||||
<div class="col-md-12 mb-3 mb-md-0">
|
||||
<label for="option-job-type-1">
|
||||
You are not an employer.
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<div class="p-4 mb-3 bg-white">
|
||||
<h3 class="h5 text-black mb-3">Contact Info</h3>
|
||||
<p class="mb-0 font-weight-bold">Address</p>
|
||||
<p class="mb-4">203 Fake St. Mountain View, San Francisco, California, USA</p>
|
||||
|
||||
<p class="mb-0 font-weight-bold">Phone</p>
|
||||
<p class="mb-4"><a href="#">+1 232 3235 324</a></p>
|
||||
|
||||
<p class="mb-0 font-weight-bold">Email Address</p>
|
||||
<p class="mb-0"><a href="#"><span class="__cf_email__" data-cfemail="671e081215020a060e0b2703080a060e094904080a">[email protected]</span></a></p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="p-4 mb-3 bg-white">
|
||||
<h3 class="h5 text-black mb-3">More Info</h3>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa ad iure porro mollitia architecto hic consequuntur. Distinctio nisi perferendis dolore, ipsa consectetur</p>
|
||||
<p><a href="#" class="btn btn-primary py-2 px-4">Learn More</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -125,76 +125,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="ftco-section services-section bg-light">
|
||||
<div class="container">
|
||||
<div class="row d-flex">
|
||||
<div class="col-md-3 d-flex align-self-stretch ftco-animate">
|
||||
<div class="media block-6 services d-block">
|
||||
<div class="icon"><span class="flaticon-resume"></span></div>
|
||||
<div class="media-body">
|
||||
<h3 class="heading mb-3">Search Millions of Jobs</h3>
|
||||
<p>A small river named Duden flows by their place and supplies.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 d-flex align-self-stretch ftco-animate">
|
||||
<div class="media block-6 services d-block">
|
||||
<div class="icon"><span class="flaticon-collaboration"></span></div>
|
||||
<div class="media-body">
|
||||
<h3 class="heading mb-3">Easy To Manage Jobs</h3>
|
||||
<p>A small river named Duden flows by their place and supplies.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 d-flex align-self-stretch ftco-animate">
|
||||
<div class="media block-6 services d-block">
|
||||
<div class="icon"><span class="flaticon-promotions"></span></div>
|
||||
<div class="media-body">
|
||||
<h3 class="heading mb-3">Top Careers</h3>
|
||||
<p>A small river named Duden flows by their place and supplies.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 d-flex align-self-stretch ftco-animate">
|
||||
<div class="media block-6 services d-block">
|
||||
<div class="icon"><span class="flaticon-employee"></span></div>
|
||||
<div class="media-body">
|
||||
<h3 class="heading mb-3">Search Expert Candidates</h3>
|
||||
<p>A small river named Duden flows by their place and supplies.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="ftco-section ftco-counter">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center mb-5 pb-3">
|
||||
<div class="col-md-7 heading-section text-center ftco-animate">
|
||||
<span class="subheading">Categories work wating for you</span>
|
||||
<h2 class="mb-4"><span>Current</span> Job Posts</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
{% for category in categories %}
|
||||
<div class="col-md-3 ftco-animate">
|
||||
<ul class="category">
|
||||
<li><a href="{% url 'jobs:category_detail' category.slug category.pk %}">{{ category.title }}<span class="number" data-number="{{ category.job_count }}">0</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="ftco-section bg-light">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center mb-5 pb-3">
|
||||
<div class="col-md-7 heading-section text-center ftco-animate">
|
||||
<span class="subheading">Recently Added Jobs</span>
|
||||
<h2 class="mb-4"><span>Recent</span> Jobs</h2>
|
||||
<h2 class="mb-4"><span>My</span> jobs</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
Loading…
Reference in New Issue
Block a user