diff --git a/jobs/views.py b/jobs/views.py
index 9dbd2b1..e82dbad 100644
--- a/jobs/views.py
+++ b/jobs/views.py
@@ -50,6 +50,7 @@ class SingleJobView(SuccessMessageMixin, UpdateView):
context['employee_applied'] = Job.objects.get(pk=self.kwargs['pk']).employee.all().filter(id=self.request.user.id)
try:
context['applied_employees'] = Job.objects.get(pk=self.kwargs['pk'], employer_id=self.request.user.id).employee.all()
+ context['employer_id'] = Job.objects.get(pk=self.kwargs['pk']).employer_id
except:
pass
return context
diff --git a/templates/jobs/single.html b/templates/jobs/single.html
index 07fe9fe..399b85c 100644
--- a/templates/jobs/single.html
+++ b/templates/jobs/single.html
@@ -36,14 +36,14 @@
{% endif %}
- {% if user.is_employer %}
+ {% if user.is_employer and user.id == employer_id %}
{% if applied_employees %}
{% else %}
diff --git a/templates/users/employee-profile.html b/templates/users/employee-profile.html
new file mode 100644
index 0000000..2f93501
--- /dev/null
+++ b/templates/users/employee-profile.html
@@ -0,0 +1,53 @@
+{% extends 'base.html' %}
+{% load static %}
+{% block content %}
+
+
+
+
+
+
Home Blog Single
+
Job detail
+
+
+
+
+
+
+
+
+
+
{{ account.first_name }} {{ account.last_name }}
+
+
{{ account.email }}
+
{{ profile.birth_day }}
+
{{ profile.location }}
+
{{ profile.resume|safe }}
+
+
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/users/urls.py b/users/urls.py
index c4b664b..4140687 100644
--- a/users/urls.py
+++ b/users/urls.py
@@ -7,4 +7,5 @@ urlpatterns = [
path('login/', UserLoginView.as_view(), name='login'),
path('logout/', UserLogoutView.as_view(), name='logout'),
path('update-profile//', UserUpdateView.as_view(), name='update_profile'),
+ path('employee-profile//', EmployeeProfileView.as_view(), name='employee_profile'),
]
diff --git a/users/views.py b/users/views.py
index 571adec..c3e834b 100644
--- a/users/views.py
+++ b/users/views.py
@@ -5,10 +5,11 @@ from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.decorators import method_decorator
-from django.views.generic import CreateView, UpdateView
+from django.views.generic import CreateView, UpdateView, DetailView
+from jobs.models import Category
from users.forms import AccountRegisterForm, UserUpdateForm
-from users.models import Profile
+from users.models import Profile, Account
class UserRegisterView(SuccessMessageMixin, CreateView):
@@ -57,3 +58,15 @@ class UserUpdateView(SuccessMessageMixin, UpdateView):
def get_success_url(self):
return reverse('users: update_profile', kwargs={'pk': self.object.pk})
+
+
+class EmployeeProfileView(DetailView):
+ template_name = 'users/employee-profile.html'
+ model = Account
+
+ def get_context_data(self, **kwargs):
+ context = super(EmployeeProfileView, self).get_context_data(**kwargs)
+ context['account'] = Account.objects.get(pk=self.kwargs['pk'])
+ context['profile'] = Profile.objects.get(user_id=self.kwargs['pk'])
+ context['categories'] = Category.objects.all()
+ return context