22# created invite form

This commit is contained in:
Eligiusz Kurzawa 2021-01-15 12:27:14 +01:00
parent c9465b91a3
commit c3c8d97d51
3 changed files with 44 additions and 3 deletions

View File

@ -24,6 +24,35 @@
<h5>{{ profile.location }}</h5>
<p>{{ profile.resume|safe }}</p>
<hr>
<h3>Send an invitation to employee</h3>
<form action="" method="post">
<div class="row form-group">
<div class="col-md-12">
<label class="font-weight-bold" for="fullname">Date</label>
</div>
<div class="col-md-12 mb-3 mb-md-0">
<label for="option-job-type-1">
{{ form.date }}
</label>
</div>
</div>
<div class="row form-group">
<div class="col-md-12">
<label class="font-weight-bold" for="fullname">Message</label>
</div>
<div class="col-md-12 mb-3 mb-md-0">
<label for="option-job-type-1">
{{ form.media }}
{{ form.message }}
</label>
</div>
</div>
<div class="row form-group">
<div class="col-md-12">
<input type="submit" style="margin-left: 270px" value="Send" class="btn btn-primary py-2 px-5">
</div>
</div>
</form>
</div> <!-- .col-md-8 -->
<div class="col-md-4 sidebar ftco-animate">

View File

@ -1,6 +1,7 @@
import form as form
from django import forms
from django.contrib.auth.forms import UserCreationForm
from users.models import Account, Profile
from users.models import Account, Profile, Invite
class AccountRegisterForm(UserCreationForm):
@ -20,3 +21,13 @@ class UserUpdateForm(forms.ModelForm):
widgets = {
'birthday': forms.DateInput(attrs={'type': 'date'})
}
class InviteEmployeeForm(forms.ModelForm):
class Meta:
model = Invite
fields = ('date', 'message')
widgets = {
'date': forms.DateInput(attrs={'type': 'date'})
}

View File

@ -8,7 +8,7 @@ from django.utils.decorators import method_decorator
from django.views.generic import CreateView, UpdateView, DetailView, ListView
from jobs.models import Category, Job
from users.forms import AccountRegisterForm, UserUpdateForm
from users.forms import AccountRegisterForm, UserUpdateForm, InviteEmployeeForm
from users.models import Profile, Account
@ -60,9 +60,10 @@ class UserUpdateView(SuccessMessageMixin, UpdateView):
return reverse('users: update_profile', kwargs={'pk': self.object.pk})
class EmployeeProfileView(DetailView):
class EmployeeProfileView(CreateView):
template_name = 'users/employee-profile.html'
model = Account
form_class = InviteEmployeeForm
def get_context_data(self, **kwargs):
context = super(EmployeeProfileView, self).get_context_data(**kwargs)