added messages support, more clean html
This commit is contained in:
parent
2806ccbb44
commit
9529067c8b
9 changed files with 104 additions and 34 deletions
|
@ -1,5 +1,5 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import Job, Application, Tag, Question, Answer
|
||||
from .models import Job, Application, Tag, Question, Answer, JobMessage
|
||||
|
||||
admin.site.register([Job, Application, Tag, Question, Answer])
|
||||
admin.site.register([Job, Application, Tag, Question, Answer, JobMessage])
|
||||
|
|
|
@ -2,7 +2,7 @@ from django import forms
|
|||
from django.forms import inlineformset_factory
|
||||
from dal.autocomplete import ModelSelect2Multiple
|
||||
|
||||
from .models import Job, Question, Application, Answer
|
||||
from .models import Job, Question, Application, Answer, JobMessage
|
||||
|
||||
|
||||
class JobForm(forms.ModelForm):
|
||||
|
@ -13,6 +13,12 @@ class JobForm(forms.ModelForm):
|
|||
'tags': ModelSelect2Multiple(url='jobs:tag-autocomplete')
|
||||
}
|
||||
|
||||
class MessageForm(forms.ModelForm):
|
||||
text = forms.CharField(label='', widget=forms.TextInput(attrs={"placeholder": "Write your message"}))
|
||||
class Meta:
|
||||
model = JobMessage
|
||||
fields = ('text',)
|
||||
|
||||
|
||||
class QuestionForm(forms.ModelForm):
|
||||
class Meta:
|
||||
|
|
|
@ -42,6 +42,8 @@ class Job(models.Model):
|
|||
posted_by = models.ForeignKey(
|
||||
User, related_name="jobs", on_delete=models.CASCADE)
|
||||
|
||||
active = models.BooleanField(default=True)
|
||||
|
||||
def renew(self):
|
||||
self.expires = after_30_days()
|
||||
self.save()
|
||||
|
@ -96,3 +98,13 @@ class Answer(models.Model):
|
|||
|
||||
def __str__(self):
|
||||
return "Answer for : {0} - {1}".format(self.question, self.application)
|
||||
|
||||
class JobMessage(models.Model):
|
||||
"""Basic user to user messaging app"""
|
||||
sender = models.ForeignKey(User, on_delete=models.CASCADE, related_name="sender")
|
||||
receiver = models.ForeignKey(User, on_delete=models.CASCADE, related_name="receiver")
|
||||
text = models.TextField()
|
||||
date = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return '{}, {}'.format(self.sender, self.text[:50])
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block body_content %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
|
||||
<h1 class="display-4">Applications</h1>
|
||||
<p class="lead"></p>
|
||||
</div>
|
||||
{% for application in applications %}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">
|
||||
<a href="{{ application.get_absolute_url }}">Submitted by: {{ application.applicant }}</a>
|
||||
</h4>
|
||||
<p class="card-text">
|
||||
Submitted: {{ application.created }}
|
||||
</p>
|
||||
<p class="card-text">
|
||||
{{ application.cover_text }}
|
||||
</p>
|
||||
<ol>
|
||||
{% for answer in application.answers.all %}
|
||||
<li>{{answer.question}}<p>{{answer.text}}</p></li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
10
jobs/templates/jobs/conversation.html
Normal file
10
jobs/templates/jobs/conversation.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
10
jobs/templates/jobs/job.html
Normal file
10
jobs/templates/jobs/job.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
43
jobs/templates/jobs/jobmessage_list.html
Normal file
43
jobs/templates/jobs/jobmessage_list.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block body_content %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
|
||||
<h1 class="h2 text-center">{{ title }}</h1>
|
||||
<p class="lead"></p>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">First</th>
|
||||
<th scope="col">Last</th>
|
||||
<th scope="col">Handle</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">1</th>
|
||||
<td>Mark</td>
|
||||
<td>Otto</td>
|
||||
<td>@mdo</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">2</th>
|
||||
<td>Jacob</td>
|
||||
<td>Thornton</td>
|
||||
<td>@fat</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">3</th>
|
||||
<td colspan="2">Larry the Bird</td>
|
||||
<td>@twitter</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% for jobmessage in jobmessages %}
|
||||
{% endfor %}
|
10
jobs/templates/jobs/list_applications_others.html
Normal file
10
jobs/templates/jobs/list_applications_others.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>$Title$</title>
|
||||
</head>
|
||||
<body>
|
||||
$END$
|
||||
</body>
|
||||
</html>
|
10
jobs/templates/jobs/list_own_applications.html
Normal file
10
jobs/templates/jobs/list_own_applications.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue