<file_sep>import datetime

from django.db import models
from django.utils.translation import ugettext_lazy as _
from parler.models import TranslatableModel, TranslatedFields
from django.contrib.auth.models import User
from django.utils import timezone


class Country(TranslatableModel):

    translations = TranslatedFields(
        name=models.CharField(max_length=40, verbose_name=_('Name'))
    )
    creation_date = models.DateTimeField(
        default=timezone.now, verbose_name=_("Creation Date"))

    class Meta:
        verbose_name = _('Country')
        verbose_name_plural = _('Countries')

    def __str__(self):
        return self.name


class City(TranslatableModel):
    country = models.ForeignKey(
        Country,
        related_name='cities',
        on_delete=models.CASCADE,
        verbose_name=_('Country')
    )

    translations = TranslatedFields(
        name=models.CharField(max_length=50, verbose_name=_('Name'))
    )

    class Meta:
        verbose_name = _('City')
        verbose_name_plural = _('Cities')

    def __str__(self):
        return self.name


class School(TranslatableModel):

    translations = TranslatedFields(
        name=models.CharField(max_length=200, verbose_name=_('Name'))
    )
    city = models.ForeignKey(
        City, on_delete=models.CASCADE, verbose_name=_('City'))

    class Meta:
        verbose_name = _('School')
        verbose_name_plural = _('Schools')

    def __str__(self):
        return self.name


class Profession(TranslatableModel):

    translations = TranslatedFields(
        name=models.CharField(max_length=50, verbose_name=_('Name')),
        description=models.CharField(
            max_length=200, default='', verbose_name=_('Description'))
    )

    class Meta:
        verbose_name = _('Profession')
        verbose_name_plural = _('Professions')

    def __str__(self):
        return self.name


class Professional(models.Model):
    user = models.OneToOneField(
        User, on_delete=models.CASCADE, verbose_name=_('User'))
    city = models.ForeignKey(
        City,
        related_name=_('professionals'),
        on_delete=models.CASCADE,
        default='',
        verbose_name=_('City')
    )
    professions = models.ManyToManyField(
        Profession, verbose_name=_('Professions'))
    phone = models.CharField(
        max_length=9, default='', verbose_name=_('Phone'))
    id_number = models.CharField(
        max_length=11, default='', verbose_name=_('Id Number'))
    id_image = models.ImageField(
        null=False, blank=True, verbose_name=_('Id Image'))
    status = models.BooleanField(default=True, verbose_name=_('Status'))
    birthdate = models.DateField(
        default=datetime.date.today, verbose_name=_('Birthdate'))
    creation_date = models.DateTimeField(
        default=timezone.now, verbose_name=_('Creation Date'))
    profile_picture = models.ImageField(
        null=True, blank=True, verbose_name=_('Profile Picture'))

    class Meta:
        verbose_name = _('Professional')
        verbose_name_plural = _('Professionals')

    def __str__(self):
        return self.user.get_username()


class Curriculum(models.Model):
    owner = models.OneToOneField(
        Professional, on_delete=models.CASCADE, verbose_name=_('Owner'))
    contract_price = models.IntegerField(
        default=0, verbose_name=_('Contract price'))
    score = models.IntegerField(default=5, verbose_name=_('Score'))

    class Meta:
        verbose_name = _('Curriculum')
        verbose_name_plural = _('Curriculums')

    def __str__(self):
        return self.owner.user.get_username() + '-cv'


class Job(models.Model):

    cv = models.ForeignKey(
        Curriculum,
        related_name=_('jobs'),
        on_delete=models.CASCADE
    )
    profession = models.ForeignKey(
        Profession, on_delete=models.CASCADE, verbose_name=_('Profession'))
    description = models.TextField(
        max_length=500, default='', verbose_name=_('Description'))
    start_date = models.DateTimeField(
        default=timezone.now, verbose_name=_('Start Date'))
    finish_date = models.DateTimeField(
        default=timezone.now, verbose_name=_('Finish Date'))

    class Meta:
        verbose_name = _('Job')
        verbose_name_plural = _('Jobs')

    def __str__(self):
        return self.profession.name


class JobOffer(models.Model):
    user = models.ForeignKey(
        Professional,
        related_name='job_offers',
        on_delete=models.CASCADE,
        verbose_name=_('User')
    )
    city = models.ForeignKey(
        City,
        related_name='job_offers',
        on_delete=models.CASCADE, default='',
        verbose_name=_('City')
    )

    description = models.CharField(
        max_length=100, default='', verbose_name=_('Description'))
    creation_date = models.DateTimeField(
        default=timezone.now, verbose_name=_('Creation Date'))
    status = models.BooleanField(default=True, verbose_name=_('Status'))

    class Meta:
        verbose_name = _('Job Offer')
        verbose_name_plural = _('Job Offers')


class Employment(models.Model):
    offer = models.ForeignKey(
        JobOffer,
        related_name='employments',
        on_delete=models.CASCADE,
        verbose_name=_('Offer')
    )
    profession = models.ForeignKey(
        Profession, on_delete=models.CASCADE, verbose_name=_('Profession'))
    description = models.TextField(
        max_length=200, default='', verbose_name=_('Description'))
    reward = models.FloatField(default=0, verbose_name=_('Reward'))
    status = models.BooleanField(default=True, verbose_name=_('Status'))

    class Meta:
        verbose_name = _('Employment')
        verbose_name_plural = _('Employments')


class Study(models.Model):
    cv = models.ForeignKey(
        Curriculum,
        related_name='studies',
        on_delete=models.CASCADE
    )
    school = models.ForeignKey(
        School, on_delete=models.CASCADE, verbose_name=_('School')
    )
    profession = models.ForeignKey(
        Profession, on_delete=models.CASCADE, verbose_name=_('Profession')
    )
    name = models.CharField(max_length=100, default='', verbose_name=_('Name'))
    image = models.ImageField(null=False, blank=True, verbose_name=_('Image'))

    class Meta:
        verbose_name = _('Study')
        verbose_name_plural = _('Studies')


class ChatRoom(models.Model):
    users = models.ManyToManyField(Professional, verbose_name=_('Users'))
    creation_date = models.DateTimeField(
        default=timezone.now, verbose_name=_('Creation Date')
    )
    status = models.BooleanField(default=True, verbose_name=_('Status'))

    class Meta:
        verbose_name = _('Chat Room')
        verbose_name_plural = _('Chat Rooms')


class Message(models.Model):
    chat_room = models.ForeignKey(
        ChatRoom, on_delete=models.CASCADE, verbose_name=_('Chat Room'))
    user = models.ForeignKey(
        Professional, on_delete=models.CASCADE, verbose_name=_('User'))
    message = models.CharField(
        max_length=400, verbose_name=_('Message'))
    creation_date = models.DateTimeField(
        default=timezone.now, verbose_name=_('Creation Date'))

    class Meta:
        verbose_name = _('Message')
        verbose_name_plural = _('Messages')
<file_sep># Generated by Django 3.1.2 on 2020-11-30 19:19

import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0009_auto_20201129_0123'),
    ]

    operations = [
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 12, 1, 19, 19, 56, 57812, tzinfo=utc)),
        ),
        migrations.CreateModel(
            name='Study',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=50)),
                ('cv', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.curriculum')),
                ('profession', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.profession')),
                ('school', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.school')),
            ],
        ),
    ]
<file_sep>from selenium import webdriver
from django.contrib.staticfiles.testing import StaticLiveServerTestCase


class SeleniumBaseTestCase(StaticLiveServerTestCase):
    def setUp(self) -> None:
        self.driver = webdriver.Chrome()
        self.driver.implicitly_wait(2)
        self.driver.maximize_window()

    def tearDown(self) -> None:
        self.driver.close()
<file_sep># Generated by Django 3.1.2 on 2020-11-27 00:16

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import parler.models


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='ChatRoom',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creation_date', models.DateTimeField(default=django.utils.timezone.now)),
            ],
        ),
        migrations.CreateModel(
            name='Profession',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
            bases=(parler.models.TranslatableModelMixin, models.Model),
        ),
        migrations.RemoveField(
            model_name='professional',
            name='description',
        ),
        migrations.AddField(
            model_name='professional',
            name='creation_date',
            field=models.DateTimeField(default=django.utils.timezone.now),
        ),
        migrations.AddField(
            model_name='professional',
            name='ruc',
            field=models.CharField(default='00000000000', max_length=11),
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('message', models.CharField(max_length=400)),
                ('creation_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('chat_room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.chatroom')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.professional')),
            ],
        ),
        migrations.AddField(
            model_name='chatroom',
            name='users',
            field=models.ManyToManyField(to='work_day.Professional'),
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-11-27 22:35

import datetime
from django.db import migrations, models
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0006_auto_20201127_1732'),
    ]

    operations = [
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 11, 28, 22, 35, 21, 35704, tzinfo=utc)),
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-11-27 02:18

import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
import django.utils.timezone


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0002_auto_20201126_1916'),
    ]

    operations = [
        migrations.CreateModel(
            name='Curriculum',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('owner', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='work_day.professional')),
            ],
        ),
        migrations.AddField(
            model_name='profession',
            name='description',
            field=models.CharField(default='', max_length=100),
        ),
        migrations.CreateModel(
            name='JobOffer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creation_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.professional')),
            ],
        ),
        migrations.CreateModel(
            name='Job',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.TextField(default='', max_length=500)),
                ('start_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('finish_date', models.DateTimeField(default=datetime.datetime(2020, 11, 28, 2, 18, 59, 358602, tzinfo=utc))),
                ('cv', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.curriculum')),
                ('profession', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='work_day.profession')),
            ],
        ),
        migrations.CreateModel(
            name='Employment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.TextField(default='', max_length=200)),
                ('offer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.joboffer')),
                ('profession', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='work_day.profession')),
            ],
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-12-11 21:58

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0023_auto_20201209_1207'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='message',
            options={'ordering': ['creation_date']},
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-12-09 00:18

import datetime
from django.db import migrations, models
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0020_auto_20201208_1836'),
    ]

    operations = [
        migrations.AddField(
            model_name='professional',
            name='id_image',
            field=models.ImageField(blank=True, upload_to=''),
        ),
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 12, 10, 0, 18, 58, 834065, tzinfo=utc)),
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-12-02 01:30

import datetime
from django.db import migrations, models
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0014_auto_20201201_1940'),
    ]

    operations = [
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 12, 3, 1, 30, 52, 942806, tzinfo=utc)),
        ),
    ]
<file_sep>import datetime

from django.test import (
    TestCase,
    Client
)
from django.urls import reverse
from django.utils import timezone

from work_day.models import *


class BaseTest(TestCase):
    def setUp(self):
        self.login_url = reverse('login')
        self.register_url = reverse('register')
        user = User.objects.create_user(
            username='testUser', password='<PASSWORD>'
        )
        self.country = Country.objects.create(name='Peru')
        self.city = City.objects.create(country=self.country, name='Arequipa')
        self.professional = Professional.objects.create(
            user=user, city=self.city, phone='999999999', id_number='11111111',
        )
        cv = Curriculum.objects.create(owner=self.professional)
        return super().setUp()


class LoginTest(BaseTest):
    def test_can_access_page(self):
        response = self.client.get(self.login_url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'users/login.html')

    def test_successful_login(self):
        response = self.client.post(
            self.login_url,
            {'username': 'testUser', 'password': '<PASSWORD>'},
            follow=True
        )
        self.assertEqual(response.status_code, 200)
        self.assertTrue(response.context['user'].is_authenticated)
        self.assertRedirects(response, reverse('home'))

    def test_cant_login_with_invalid_username(self):
        response = self.client.post(
            self.login_url,
            {'username': '', 'password': '<PASSWORD>'},
            follow=True
        )
        self.assertFalse(response.context['user'].is_authenticated)


class RegisterTest(BaseTest):
    def test_can_access_page(self):
        response = self.client.get(self.register_url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'users/register.html')


class ViewsTest(BaseTest):
    def test_index_view_doesnt_require_login(self):
        response = self.client.get(reverse('index'), follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'index.html')

    def test_home_view_without_login(self):
        response = self.client.get(reverse('home'), follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'users/login.html')

    def test_home_view_with_login(self):
        self.client.login(username='testUser', password='<PASSWORD>')
        response = self.client.get(reverse('home'), follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'home.html')

    def test_view_user_profile_without_login(self):
        response = self.client.get(reverse('user_profile'), follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'users/login.html')

    def test_view_own_user_profile_with_login(self):
        self.client.login(username='testUser', password='<PASSWORD>')
        response = self.client.get(reverse('user_profile'), follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'users/profile.html')

    def test_view_professionals_without_login(self):
        response = self.client.get(reverse('professionals'), follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'users/login.html')

    def test_view_professionals_with_login(self):
        self.client.login(username='testUser', password='<PASSWORD>')
        response = self.client.get(reverse('professionals'), follow=True)
        print(response.context['professionals'][0])
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'professionals.html')
        self.assertEqual(len(response.context['professionals']), 1)

    def test_view_my_posts_receive_offers_list(self):
        self.client.login(username='testUser', password='<PASSWORD>')
        response = self.client.get(reverse('my_posts'), follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'my_posts.html')
        self.assertEqual(len(response.context['offers']), 0)<file_sep># Generated by Django 3.1.2 on 2020-12-07 14:25

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0016_auto_20201205_1839'),
        ('work_day', '0017_auto_20201206_1810'),
    ]

    operations = [
    ]
<file_sep>import django_filters

from django_filters import CharFilter

from .models import *


class ProfessionalFilter(django_filters.FilterSet):
    user__first_name = CharFilter(lookup_expr='icontains')
    user__last_name = CharFilter(lookup_expr='icontains')

    class Meta:
        model = Professional
        fields = ['city', 'professions']
<file_sep># Generated by Django 3.1.2 on 2020-11-27 22:15

import datetime
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
from django.utils.timezone import utc
import parler.models


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0003_auto_20201126_2118'),
    ]

    operations = [
        migrations.CreateModel(
            name='City',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
            bases=(parler.models.TranslatableModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Country',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('creation_date', models.DateTimeField(default=django.utils.timezone.now)),
            ],
            bases=(parler.models.TranslatableModelMixin, models.Model),
        ),
        migrations.RemoveField(
            model_name='professional',
            name='ruc',
        ),
        migrations.AddField(
            model_name='chatroom',
            name='status',
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name='curriculum',
            name='contract_price',
            field=models.IntegerField(default=0),
        ),
        migrations.AddField(
            model_name='curriculum',
            name='score',
            field=models.IntegerField(default=5),
        ),
        migrations.AddField(
            model_name='employment',
            name='reward',
            field=models.FloatField(default=0),
        ),
        migrations.AddField(
            model_name='employment',
            name='status',
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name='joboffer',
            name='description',
            field=models.CharField(default='', max_length=100),
        ),
        migrations.AddField(
            model_name='joboffer',
            name='status',
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name='professional',
            name='id_number',
            field=models.CharField(default='', max_length=11),
        ),
        migrations.AddField(
            model_name='professional',
            name='phone',
            field=models.CharField(default='', max_length=9),
        ),
        migrations.AddField(
            model_name='professional',
            name='professions',
            field=models.ManyToManyField(to='work_day.Profession'),
        ),
        migrations.AddField(
            model_name='professional',
            name='status',
            field=models.BooleanField(default=True),
        ),
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 11, 28, 22, 15, 29, 539038, tzinfo=utc)),
        ),
        migrations.CreateModel(
            name='School',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('city', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.city')),
            ],
            bases=(parler.models.TranslatableModelMixin, models.Model),
        ),
        migrations.AddField(
            model_name='city',
            name='country',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.country'),
        ),
        migrations.AddField(
            model_name='joboffer',
            name='city',
            field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='work_day.city'),
        ),
        migrations.AddField(
            model_name='professional',
            name='city',
            field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='work_day.city'),
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-12-19 22:09

import datetime
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0025_auto_20201219_1616'),
    ]

    operations = [
        migrations.AddField(
            model_name='professional',
            name='birthdate',
            field=models.DateField(default=datetime.date.today, verbose_name='Birthdate'),
        ),
        migrations.AlterField(
            model_name='professiontranslation',
            name='description',
            field=models.CharField(default='', max_length=200, verbose_name='Description'),
        ),
        migrations.AlterField(
            model_name='study',
            name='name',
            field=models.CharField(default='', max_length=100, verbose_name='Name'),
        ),
    ]
<file_sep>## Instalación
- Clonar repositorio
- pip install -r requirements.txt
- Establecer env variables en .env (copiar de .env_default)

## Base de datos
####Configuración
- Ejecutar los siguientes comandos en la terminal:  
sudo su postgres -c psql  
CREATE USER username WITH PASSWORD '<PASSWORD>';  
CREATE DATABASE workday_db OWNER username ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';  
GRANT ALL PRIVILEGES ON DATABASE workday_db TO username;  
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO username;  
ALTER USER username CREATEDB;  
ALTER ROLE username SUPERUSER;
<file_sep># Generated by Django 3.1.2 on 2020-12-19 16:16

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('work_day', '0024_auto_20201218_2312'),
    ]

    operations = [
        migrations.AlterField(
            model_name='chatroom',
            name='creation_date',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Creation Date'),
        ),
        migrations.AlterField(
            model_name='chatroom',
            name='status',
            field=models.BooleanField(default=True, verbose_name='Status'),
        ),
        migrations.AlterField(
            model_name='chatroom',
            name='users',
            field=models.ManyToManyField(to='work_day.Professional', verbose_name='Users'),
        ),
        migrations.AlterField(
            model_name='city',
            name='country',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cities', to='work_day.country', verbose_name='Country'),
        ),
        migrations.AlterField(
            model_name='curriculum',
            name='contract_price',
            field=models.IntegerField(default=0, verbose_name='Contract price'),
        ),
        migrations.AlterField(
            model_name='curriculum',
            name='owner',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='work_day.professional', verbose_name='Owner'),
        ),
        migrations.AlterField(
            model_name='curriculum',
            name='score',
            field=models.IntegerField(default=5, verbose_name='Score'),
        ),
        migrations.AlterField(
            model_name='employment',
            name='offer',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='employments', to='work_day.joboffer', verbose_name='Offer'),
        ),
        migrations.AlterField(
            model_name='employment',
            name='profession',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.profession', verbose_name='Profession'),
        ),
        migrations.AlterField(
            model_name='employment',
            name='reward',
            field=models.FloatField(default=0, verbose_name='Reward'),
        ),
        migrations.AlterField(
            model_name='employment',
            name='status',
            field=models.BooleanField(default=True, verbose_name='Status'),
        ),
        migrations.AlterField(
            model_name='job',
            name='description',
            field=models.TextField(default='', max_length=500, verbose_name='Description'),
        ),
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Finish Date'),
        ),
        migrations.AlterField(
            model_name='job',
            name='profession',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.profession', verbose_name='Profession'),
        ),
        migrations.AlterField(
            model_name='job',
            name='start_date',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Start Date'),
        ),
        migrations.AlterField(
            model_name='joboffer',
            name='city',
            field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, related_name='job_offers', to='work_day.city', verbose_name='City'),
        ),
        migrations.AlterField(
            model_name='joboffer',
            name='creation_date',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Creation Date'),
        ),
        migrations.AlterField(
            model_name='joboffer',
            name='status',
            field=models.BooleanField(default=True, verbose_name='Status'),
        ),
        migrations.AlterField(
            model_name='joboffer',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='job_offers', to='work_day.professional', verbose_name='User'),
        ),
        migrations.AlterField(
            model_name='message',
            name='chat_room',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.chatroom', verbose_name='Chat Room'),
        ),
        migrations.AlterField(
            model_name='message',
            name='creation_date',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Creation Date'),
        ),
        migrations.AlterField(
            model_name='message',
            name='message',
            field=models.CharField(max_length=400, verbose_name='Message'),
        ),
        migrations.AlterField(
            model_name='message',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.professional', verbose_name='User'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='city',
            field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, related_name='professionals', to='work_day.city', verbose_name='City'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='creation_date',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Creation Date'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='id_image',
            field=models.ImageField(blank=True, upload_to='', verbose_name='Id Image'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='id_number',
            field=models.CharField(default='', max_length=11, verbose_name='Id Number'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='phone',
            field=models.CharField(default='', max_length=9, verbose_name='Phone'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='professions',
            field=models.ManyToManyField(to='work_day.Profession', verbose_name='Professions'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='profile_picture',
            field=models.ImageField(blank=True, null=True, upload_to='', verbose_name='Profile Picture'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='status',
            field=models.BooleanField(default=True, verbose_name='Status'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='user',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User'),
        ),
        migrations.AlterField(
            model_name='school',
            name='city',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.city', verbose_name='City'),
        ),
        migrations.AlterField(
            model_name='study',
            name='image',
            field=models.ImageField(blank=True, upload_to='', verbose_name='Image'),
        ),
        migrations.AlterField(
            model_name='study',
            name='name',
            field=models.CharField(default='', max_length=50, verbose_name='Name'),
        ),
        migrations.AlterField(
            model_name='study',
            name='profession',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.profession', verbose_name='Profession'),
        ),
        migrations.AlterField(
            model_name='study',
            name='school',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.school', verbose_name='School'),
        ),
    ]
<file_sep>{% extends "format/base.html" %}
{% load static %}
{% load i18n %}
{% block title %}
    Edit profile
{% endblock %}
{% block css %}
    <link rel="stylesheet"
          href="{% static 'lib/adminlte-3.0.4/plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css' %}">
    <link rel="stylesheet" href="{% static 'lib/adminlte-3.0.4/plugins/select2/css/select2.min.css' %}">
    <link rel="stylesheet"
          href="{% static 'lib/adminlte-3.0.4/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css' %}">
    <link rel="stylesheet"
          href="{% static 'lib/adminlte-3.0.4/plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css' %}">
    <link rel="stylesheet" href="{% static 'lib/adminlte-3.0.4/plugins/bs-stepper/css/bs-stepper.min.css' %}">
    <link rel="stylesheet" href="{% static 'lib/adminlte-3.0.4/plugins/dropzone/min/dropzone.min.css' %}">
    <link rel="stylesheet" href="{% static 'lib/adminlte-3.0.4/plugins/fontawesome-free/css/fontawesome.css' %}">
{% endblock %}
{% block content %}

    <section class="content-header">

        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-5">
                    <h1 class="m-0"><i class="fa fa-cog" aria-hidden="true"></i>{% trans "Profile settings" %} </h1>
                </div><!-- /.col -->
            </div><!-- /.row -->
            <!-- /.container-fluid -->

        </div>
    </section>

    <section class="content">
        <div class="container">
            <div class="row mb-2">
                <div class="col">
                    <div class="card card-default">
                        <div class="card-header">
                            <h3 class="card-title">{% trans "Personal information settings" %}</h3>
                        </div>
                        <!-- /.card-header -->
                        <div class="card-body">
                            <form method="POST" enctype="multipart/form-data">

                                <label for="id_email">{% trans "Email address:" %}</label><br>
                                <div class="input-group mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="fas fa-envelope"></i></span>
                                    </div>
                                    {{ user_form.email }}
                                </div>

                                <label for="id_first_name">{% trans "First Name:" %}</label><br>
                                <div class="input-group mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="fas fa-user"></i></span>
                                    </div>
                                    {{ user_form.first_name }}
                                </div>

                                <label for="id_last_name">{% trans "Last Name:" %}</label><br>
                                <div class="input-group mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text "><i class="fas fa-user"></i></span>
                                    </div>
                                    {{ user_form.last_name }}
                                </div>


                                <label for="id_city">{% trans 'City:' %}</label>
                                <div class="input-group mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="fas fa-city"></i></span>
                                    </div>
                                    {{ professional_form.city }}
                                </div>

                                <label for="id_phone">{% trans "Phone number:" %}</label>
                                <div class="input-group mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="fas fa-phone"></i></span>
                                    </div>
                                    {{ professional_form.phone }}
                                </div>

                                <label for="id_id_number">{% trans "ID Number:" %}</label>
                                <div class="input-group mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="fas fa-id-card"></i></span>
                                    </div>
                                    {{ professional_form.id_number }}
                                </div>


                                <label for="exampleInputFile">{% trans "ID Card:" %}</label>
                                <div class="input-group mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="fas fa-upload"></i></span>
                                    </div>
                                    <div class="custom-file">
                                        {{ professional_form.id_image }}
                                        <label class="custom-file-label" for="exampleInputFile">{% trans "Choose file" %}</label>
                                    </div>
                                </div>


                                <label for="exampleInputFile">{% trans "Profile picture:" %}</label>
                                <div class="input-group mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="fas fa-upload"></i></span>
                                    </div>
                                    <div class="custom-file">
                                        {{ professional_form.profile_picture }}
                                        <label class="custom-file-label" for="exampleInputFile">{% trans "Choose file" %}</label>
                                    </div>
                                </div>


                                {% csrf_token %}
                                <button type="submit">{% trans 'Register' %}</button>
                            </form>

                        </div>
                        <!-- /.card-body -->
                        <div class="card-footer">

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>



{% endblock %}

{% block scripts %}

    <script src="{% static 'lib/adminlte-3.0.4/plugins/select2/js/select2.full.min.js' %}"></script>
    <script src="{% static 'lib/adminlte-3.0.4/plugins/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.min.js' %} "></script>
    <script src="{% static 'lib/adminlte-3.0.4/plugins/bs-custom-file-input/bs-custom-file-input.min.js' %} "></script>

    <script>
        $(function () {
            //Initialize Select2 Elements
            $('.select2').select2()
            //Date range picker
            $('#reservationdate').datetimepicker({
                format: 'L'
            });
        })
    </script>
    <script>
        $(function () {
            bsCustomFileInput.init();
        });
    </script>

{% endblock %}<file_sep>from selenium.webdriver.common.by import By


class RegisterLocator:
    EMAIL_INPUT = (By.XPATH, "//input[@id='id_email']")
    USERNAME_INPUT = (By.XPATH, "//input[@id='id_username']")
    PASSWORD_INPUT = (By.XPATH, "//input[@id='<PASSWORD>']")
    REPEAT_PASSWORD_INPUT = (By.XPATH, "//input[@id='<PASSWORD>']")
    FIRST_NAME_INPUT = (By.XPATH, "//input[@id='id_first_name']")
    LAST_NAME_INPUT = (By.XPATH, "//input[@id='id_last_name']")
    PROFILE_PICTURE_INPUT = (By.XPATH, "//input[@id='id_profile_picture']")
    CITY_SELECT = (By.XPATH, "//select[@id='id_city']")
    PHONE_INPUT = (By.XPATH, "//input[@id='id_phone']")
    ID_NUMBER_INPUT = (By.XPATH, "//input[@id='id_id_number']")
    ID_PHOTO_INPUT = (By.XPATH, "//input[@id='id_id_image']")
    REGISTER_BUTTON = (By.XPATH, "//button[contains(text(),'Register')]")
    LOGIN_LINK = (By.LINK_TEXT, "I already have a membership")
<file_sep># Generated by Django 3.1.2 on 2020-12-08 23:36

import datetime
from django.db import migrations, models
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0019_auto_20201208_1404'),
    ]

    operations = [
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 12, 9, 23, 36, 44, 340220, tzinfo=utc)),
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-12-09 01:43

import datetime
from django.db import migrations, models
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0021_auto_20201208_1918'),
    ]

    operations = [
        migrations.AddField(
            model_name='study',
            name='image',
            field=models.ImageField(blank=True, upload_to=''),
        ),
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 12, 10, 1, 43, 25, 149024, tzinfo=utc)),
        ),
    ]
<file_sep>from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.forms import (
    PasswordResetForm,
    SetPasswordForm,
)
from django.contrib.auth import password_validation
from django.forms import inlineformset_factory

from .models import *


class UserForm(UserCreationForm):
    class Meta:
        model = User
        fields = [
            'email',
            'username',
            'password1',
            '<PASSWORD>',
            'first_name',
            'last_name',
        ]
        labels = {
            'email': 'Email address',
            'username': 'Username',
            'password1': '<PASSWORD>',
            'password2': '<PASSWORD>',
            'first_name': 'First Name',
            'last_name': 'Last Name',
        }
        widgets = {
            'email': forms.EmailInput(
                attrs={'class': 'form-control', 'placeholder': 'Email'}),
            'username': forms.TextInput(
                attrs={'class': 'form-control', 'placeholder': 'Username'}),
            'first_name': forms.TextInput(
                attrs={'class': 'form-control', 'placeholder': 'First name'}),
            'last_name': forms.TextInput(
                attrs={'class': 'form-control', 'placeholder': 'Last name'}),
        }

    def __init__(self, *args, **kwargs):
        super(UserForm, self).__init__(*args, **kwargs)
        self.fields['password1'].widget = forms.PasswordInput(
            attrs={'class': 'form-control',
                   'placeholder': 'Password'})
        self.fields['password2'].widget = forms.PasswordInput(
            attrs={'class': 'form-control',
                   'placeholder': '<PASSWORD>'})


class ProfessionalForm(forms.ModelForm):
    class Meta:
        model = Professional
        fields = [
            'city', 'phone', 'id_number', 'id_image',
            'status', 'birthdate', 'profile_picture',
        ]
        labels = {
            'city': 'City',
            'phone': 'Phone number',
            'id_number': 'ID Number',
            'status': 'Status',
            'birthdate': 'Birthdate'
        }
        widgets = {
            'city': forms.Select(
                attrs={'class': 'form-control select2bs4',
                       'placeholder': 'City',
                       'style': 'height:100%;'}
            ),
            'phone': forms.TextInput(
                attrs={'class': 'form-control',
                       'placeholder': 'Phone number'}
            ),
            'id_number': forms.TextInput(
                attrs={'class': 'form-control',
                       'placeholder': 'Identification document'}
            ),
            'status': forms.CheckboxInput(),
            'birthdate': forms.DateInput(
                attrs={'class': 'form-control datetimepicker-input'}),
            'id_image': forms.FileInput(
                attrs={'class': 'custom-file-input'}
            ),
            'profile_picture': forms.FileInput(
                attrs={'class': 'custom-file-input'}
            ),
        }


class JobForm(forms.ModelForm):
    class Meta:
        model = Job
        fields = [
            'profession', 'description', 'start_date', 'finish_date'
        ]
        labels = {
            'profession': 'Profession',
            'description': 'Description',
            'start_date': 'Start Date',
            'finish_date': 'Finish Date',
        }
        widgets = {
            'profession': forms.Select(attrs={'class': 'form-control'}),
            'description': forms.TextInput(attrs={'class': 'form-control'}),
            'start_date': forms.DateTimeInput(attrs={'class': 'form-control'}),
            'finish_date': forms.DateTimeInput(
                attrs={'class': 'form-control'}
            ),
        }


class StudyForm(forms.ModelForm):
    class Meta:
        model = Study
        fields = [
            'school', 'profession', 'name', 'image'
        ]
        labels = {
            'school': 'Institution',
            'profession': 'Profession',
            'name': 'Degree',
        }
        widgets = {
            'school': forms.Select(attrs={'class': 'form-control'}),
            'profession': forms.Select(attrs={'class': 'form-control'}),
            'name': forms.TextInput(attrs={'class': 'form-control'}),
            'image': forms.FileInput(
                attrs={'class': 'custom-file-input'}
            ),
        }


class JobOfferForm(forms.ModelForm):
    class Meta:
        model = JobOffer
        fields = ['city', 'description', 'status']
        labels = {
            'city': 'City',
            'description': 'Description',
            'status': 'Status',
        }
        widgets = {
            'city': forms.Select(attrs={'class': 'form-control'}),
            'description': forms.TextInput(
                attrs={'class': 'form-control',
                       'placeholder': 'Enter description'}
            ),
        }


class EmploymentForm(forms.ModelForm):
    class Meta:
        model = Employment
        fields = ['profession', 'description', 'reward', 'status']
        labels = {
            'profession': 'Profession',
            'description': 'Description',
            'reward': 'Reward',
            'status': 'Status',
        }
        widgets = {
            'profession': forms.Select(attrs={'class': 'form-control'}),
            'description': forms.Textarea(
                attrs={'class': 'form-control',
                       'placeholder': 'Enter description'}
            ),
            'reward': forms.TextInput(
                attrs={'class': 'form-control',
                       'type': 'number'}
            ),
        }


EmploymentInlineFormSet = inlineformset_factory(
    JobOffer, Employment, form=EmploymentForm, extra=2, can_delete=True
)


class EditUserForm(forms.ModelForm):
    class Meta:
        model = User
        fields = (
            'email',
            'first_name',
            'last_name',
        )
        labels = {
            'email': 'Email address',
            'first_name': '<NAME>',
            'last_name': '<NAME>',
        }
        widgets = {
            'email': forms.EmailInput(
                attrs={'class': 'form-control', 'placeholder': 'Email'}),
            'first_name': forms.TextInput(
                attrs={'class': 'form-control', 'placeholder': 'First name'}),
            'last_name': forms.TextInput(
                attrs={'class': 'form-control', 'placeholder': 'Last name'}),
        }


class UserPasswordResetForm(PasswordResetForm):
    email = forms.EmailField(
        label='',
        widget=forms.EmailInput(
            attrs={'class': 'form-control', 'placeholder': 'Email'}
        )
    )


class UserPasswordResetConfirmForm(SetPasswordForm):
    new_password1 = forms.CharField(
        label="New password",
        widget=forms.PasswordInput(
            attrs={'autocomplete': 'new-password',
                   'class': 'form-control'}
        ),
        strip=False,
        help_text=password_validation.password_validators_help_text_html(),
    )
    new_password2 = forms.CharField(
        label="New password confirmation",
        strip=False,
        widget=forms.PasswordInput(
            attrs={'autocomplete': 'new-password', 'class': 'form-control'}
        ),
    )
<file_sep>asgiref==3.2.10
coverage==5.3.1
Django==3.1.2
django-environ==0.4.5
django-filter==2.4.0
django-parler==2.2
Pillow==8.0.1
psycopg2-binary==2.8.6
pytz==2020.1
selenium==3.141.0
sqlparse==0.4.1
urllib3==1.26.2
<file_sep>from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import authenticate
from django.contrib.auth import logout as do_logout
from django.contrib.auth import login as do_login
from django.contrib.auth.forms import AuthenticationForm
from django.http import HttpResponseForbidden, HttpResponse
from django.template import loader
from django.contrib.auth.decorators import login_required
from django.urls import reverse

from .forms import *
from .filters import ProfessionalFilter


def register(request):
    user_form = UserForm()
    professional_form = ProfessionalForm()
    user_form.fields['username'].help_text = None
    user_form.fields['password1'].help_text = None
    user_form.fields['password2'].help_text = None
    if request.method == "POST":
        user_form = UserForm(data=request.POST)
        professional_form = ProfessionalForm(
            data=request.POST, files=request.FILES
        )
        if user_form.is_valid() and professional_form.is_valid():
            user = user_form.save()
            professional = professional_form.save(commit=False)
            professional.user = user
            professional.save()
            Curriculum.objects.create(owner=professional)
            return redirect('login')

    return render(
        request,
        "users/register.html",
        {
            'user_form': user_form,
            'professional_form': professional_form
        }
    )


def login(request):
    form = AuthenticationForm()
    if request.method == "POST":
        form = AuthenticationForm(data=request.POST)
        if form.is_valid():
            username = form.cleaned_data['username']
            password = form.cleaned_data['<PASSWORD>']
            user = authenticate(username=username, password=password)
            if user is not None:
                do_login(request, user)
                return redirect('/home')
    template = loader.get_template('users/login.html')
    context = {
        'form': form
    }
    return HttpResponse(template.render(context, request))


@login_required(login_url='/login')
def logout(request):
    do_logout(request)
    return redirect('/')


@login_required(login_url='/login')
def home(request):
    try:
        offers = JobOffer.objects.filter(
            employments__profession=
            request.user.professional.professions.all()[0]
        ).distinct()
    except IndexError:
        professional = Professional.objects.get(user=request.user)
        offers = JobOffer.objects.filter(
            city=professional.city
        )
    template = loader.get_template('home.html')
    context = {
        'offers': offers
    }
    return HttpResponse(template.render(context, request))


@login_required(login_url='/login')
def messages(request):
    return render(request, "messages.html")


@login_required(login_url='/login')
def user_profile(request, pk=None):
    if pk:
        current_user = User.objects.get(pk=pk)
    else:
        current_user = request.user
    professional = Professional.objects.get(user=current_user)
    professions = professional.professions.all()
    cv = Curriculum.objects.get(owner=professional)
    studies = cv.studies.all()
    jobs = cv.jobs.all()
    template = loader.get_template('users/profile.html')
    context = {
        'user': current_user,
        'professional': professional,
        'professions': professions,
        'cv': cv,
        'studies': studies,
        'jobs': jobs,
    }
    return HttpResponse(template.render(context, request))


@login_required(login_url='/login')
def view_professionals(request):
    professionals = Professional.objects.filter(
        status=True)
    template = loader.get_template('professionals.html')
    professional_filter = ProfessionalFilter(
        request.GET, queryset=professionals
    )
    professionals = professional_filter.qs
    context = {
        'professionals': professionals,
        'filter': professional_filter,
    }
    return HttpResponse(template.render(context, request))


@login_required(login_url='/login')
def add_job(request, pk=None):
    if pk:
        job = get_object_or_404(Job, pk=pk)
        if job.cv.owner.user != request.user:
            return HttpResponseForbidden()
    else:
        cv = Curriculum.objects.get(owner=request.user.professional)
        job = Job(cv=cv)
    form = JobForm(data=request.POST or None, instance=job)
    if request.method == 'POST':
        if form.is_valid():
            form.save()
            return redirect('home')

    return render(
        request, "add_job.html", {'form': form}
    )


@login_required(login_url='/login')
def add_study(request, pk=None):
    if pk:
        study = get_object_or_404(Study, pk=pk)
        if study.cv.owner.user != request.user:
            return HttpResponseForbidden()
    else:
        cv = Curriculum.objects.get(owner=request.user.professional)
        study = Study(cv=cv)
    form = StudyForm(
        data=request.POST or None,
        instance=study,
        files=request.FILES
    )
    if request.method == 'POST':
        if form.is_valid():
            saved_study = form.save()
            request.user.professional.professions.add(saved_study.profession)
            return redirect('../user-profile/')

    if pk:
        return render(
            request, "add_study.html", {'form': StudyForm(instance=study)}
        )
    else:
        return render(request, "add_study.html", {'form': form})


def index(request):
    return render(request, "index.html")


@login_required(login_url='/login')
def my_posts(request):
    current_user = request.user
    professional = Professional.objects.get(user=current_user)
    offers = professional.job_offers.all()
    template = loader.get_template('my_posts.html')
    context = {
        'offers': offers,
    }
    return HttpResponse(template.render(context, request))


@login_required(login_url='/login')
def create_job_offer(request, pk=None):
    if pk:
        offer = get_object_or_404(JobOffer, pk=pk)
        if offer.user.user != request.user:
            return HttpResponseForbidden()
    else:
        offer = JobOffer(user=request.user.professional)
    offer_form = JobOfferForm(data=request.POST or None, instance=offer)
    employment_formset = EmploymentInlineFormSet(
        data=request.POST or None, instance=offer)
    if request.method == 'POST':
        if offer_form.is_valid():
            offer.save()
            if employment_formset.is_valid():
                employment_formset.save()
            return redirect(reverse('my_posts'))

    return render(
        request,
        "create_offer.html",
        {
            'offer_form': offer_form,
            'employment_formset': employment_formset
        }
    )


@login_required(login_url='/login')
def job_offer(request, offer_id=None):
    offer_list = JobOffer.objects.all()
    if offer_id:
        current_offer = JobOffer.objects.get(pk=offer_id)
    else:
        current_offer = JobOffer.objects.all().first()

    context = {
        'offers': offer_list,
        'offer': current_offer,
    }
    return render(request, 'offers.html', context)


@login_required(login_url='/login')
def edit_profile(request):
    user_form = EditUserForm(
        data=request.POST or None,
        instance=request.user,
    )
    professional_form = ProfessionalForm(
        data=request.POST or None,
        instance=request.user.professional,
        files=request.FILES
    )
    if request.method == 'POST':
        if user_form.is_valid() and professional_form.is_valid():
            user_form.save()
            professional_form.save()
            return redirect('home')
    context = {
        'user_form': user_form,
        'professional_form': ProfessionalForm(
            instance=request.user.professional),
    }
    return render(request, 'users/edit_profile.html', context)
<file_sep># Generated by Django 3.1.2 on 2020-12-20 14:33

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0024_auto_20201211_2158'),
        ('work_day', '0026_auto_20201219_2209'),
    ]

    operations = [
    ]
<file_sep># Generated by Django 3.1.2 on 2020-11-29 01:23

import datetime
from django.db import migrations, models
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0008_auto_20201128_1939'),
    ]

    operations = [
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 11, 30, 1, 23, 35, 863683, tzinfo=utc)),
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-12-09 17:07

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0022_auto_20201208_2043'),
    ]

    operations = [
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=django.utils.timezone.now),
        ),
    ]
<file_sep>from selenium.webdriver.chrome.webdriver import WebDriver

from work_day.tests.locators.register_locator import RegisterLocator


class RegisterPage:
    """

    """
    def __init__(self, driver: WebDriver):
        self.driver = driver

    def get_email_input(self):
        return self.driver.find_element(*RegisterLocator.EMAIL_INPUT)

    def get_username_input(self):
        return self.driver.find_element(*RegisterLocator.USERNAME_INPUT)

    def get_password_input(self):
        return self.driver.find_element(*RegisterLocator.PASSWORD_INPUT)

    def get_password2_input(self):
        return self.driver.find_element(*RegisterLocator.REPEAT_PASSWORD_INPUT)

    def get_firstname_input(self):
        return self.driver.find_element(*RegisterLocator.FIRST_NAME_INPUT)

    def get_lastname_input(self):
        return self.driver.find_element(*RegisterLocator.LAST_NAME_INPUT)

    def get_profile_picture_input(self):
        return self.driver.find_element(*RegisterLocator.PROFILE_PICTURE_INPUT)

    def get_city_select(self):
        return self.driver.find_element(*RegisterLocator.CITY_SELECT)

    def get_phone_input(self):
        return self.driver.find_element(*RegisterLocator.PHONE_INPUT)

    def get_id_number_input(self):
        return self.driver.find_element(*RegisterLocator.ID_NUMBER_INPUT)

    def get_id_photo_input(self):
        return self.driver.find_element(*RegisterLocator.ID_PHOTO_INPUT)

    def get_register_button(self):
        return self.driver.find_element(*RegisterLocator.REGISTER_BUTTON)

    def get_login_link(self):
        return self.driver.find_element()


<file_sep># Generated by Django 3.1.2 on 2020-12-05 23:39

import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0015_auto_20201202_0130'),
    ]

    operations = [
        migrations.AlterField(
            model_name='employment',
            name='profession',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.profession'),
        ),
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 12, 6, 23, 39, 36, 743002, tzinfo=utc)),
        ),
        migrations.AlterField(
            model_name='job',
            name='profession',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='work_day.profession'),
        ),
    ]
<file_sep>from django.test import TestCase

from work_day.models import *


class BaseTest(TestCase):
    def setUp(self) -> None:
        self.user = User.objects.create_user(
            username='UserTest', password='<PASSWORD>')
        self.country = Country.objects.create(name='CountryTest')
        self.city = City.objects.create(country=self.country, name='CityTest')
        self.school = School.objects.create(name='SchoolTest', city=self.city)
        self.profession = Profession.objects.create(
            name='ProfessionTest', description='ProfessionDescription')
        self.professional = Professional.objects.create(
            user=self.user, city=self.city, phone='999999999',
            id_number='11111111', birthdate=datetime.date.today()
        )
        self.curriculum = Curriculum.objects.create(
            owner=self.professional, contract_price=100, score=5)
        self.job = Job.objects.create(
            cv=self.curriculum, profession=self.profession,
            description='JobDescription'
        )
        self.study = Study.objects.create(
            cv=self.curriculum, school=self.school,
            profession=self.profession, name='StudyTest'
        )
        self.job_offer = JobOffer.objects.create(
            user=self.professional, city=self.city, description='JobOfferTest',
        )
        self.employment = Employment.objects.create(
            offer=self.job_offer, profession=self.profession,
            description='EmploymentTest', reward=1000,
        )


class CountryModelTests(BaseTest):

    def setUp(self) -> None:
        super().setUp()

    def test_country_is_created_with_the_right_name(self):
        self.assertEqual(self.country.name, 'CountryTest')

    def test_str_function(self):
        self.assertEqual(self.country.__str__(), 'CountryTest')

    def test_cities_related_name_is_correct(self):
        self.assertEqual(len(self.country.cities.all()), 1)


class CityModelTests(BaseTest):

    def setUp(self) -> None:
        super().setUp()

    def test_city_is_created_with_the_right_name(self):
        self.assertEqual(self.city.name, 'CityTest')

    def test_str_function(self):
        self.assertEqual(self.city.__str__(), 'CityTest')


class SchoolModelTest(BaseTest):
    def setUp(self) -> None:
        super().setUp()

    def test_school_is_created_with_the_right_name(self):
        self.assertEqual(self.school.name, 'SchoolTest')

    def test_str_function(self):
        self.assertEqual(self.school.__str__(), 'SchoolTest')


class ProfessionModelTest(BaseTest):
    def setUp(self) -> None:
        super().setUp()

    def test_profession_is_created_with_the_right_attrs(self):
        self.assertEqual(self.profession.name, 'ProfessionTest')
        self.assertEqual(self.profession.description, 'ProfessionDescription')

    def test_str_function(self):
        self.assertEqual(self.profession.__str__(), 'ProfessionTest')


class ProfessionalModelTest(BaseTest):
    def setUp(self) -> None:
        super().setUp()

    def test_professional_is_created_with_the_right_attrs(self):
        self.assertEqual(self.professional.user, self.user)
        self.assertEqual(self.professional.city, self.city)
        self.assertEqual(self.professional.phone, '999999999')
        self.assertEqual(self.professional.id_number, '11111111')
        self.assertEqual(self.professional.birthdate, datetime.date.today())

    def test_str_function(self):
        self.assertEqual(self.professional.__str__(), 'UserTest')

    def test_professional_is_created_with_a_correct_birthdate(self):
        self.assertGreaterEqual(
            self.professional.birthdate, datetime.date.today())


class CurriculumModelTest(BaseTest):
    def setUp(self) -> None:
        super().setUp()

    def test_curriculum_is_created_with_the_right_attrs(self):
        self.assertEqual(self.curriculum.owner, self.professional)
        self.assertEqual(self.curriculum.contract_price, 100)
        self.assertEqual(self.curriculum.score, 5)

    def test_str_function(self):
        self.assertEqual(self.curriculum.__str__(), 'UserTest-cv')


class JobModelTest(BaseTest):
    def setUp(self) -> None:
        super().setUp()

    def test_job_is_created_with_the_right_attrs(self):
        self.assertEqual(self.job.cv, self.curriculum)
        self.assertEqual(self.job.profession, self.profession)
        self.assertEqual(self.job.description, 'JobDescription')


class StudyModelTest(BaseTest):
    def setUp(self) -> None:
        super().setUp()

    def test_study_is_created_with_the_right_attrs(self):
        self.assertEqual(self.study.cv, self.curriculum)
        self.assertEqual(self.study.profession, self.profession)
        self.assertEqual(self.study.name, 'StudyTest')
        self.assertEqual(self.study.school, self.school)


class JobOfferModelTest(BaseTest):
    def setUp(self) -> None:
        super().setUp()

    def test_job_offer_is_created_with_the_right_attrs(self):
        self.assertEqual(self.job_offer.user, self.professional)
        self.assertEqual(self.job_offer.city, self.city)
        self.assertEqual(self.job_offer.description, 'JobOfferTest')

    def test_job_offer_has_related_employments(self):
        self.assertEqual(
            self.job_offer.employments.all().first(), self.employment)
<file_sep># Generated by Django 3.1.2 on 2020-11-28 19:39

import datetime
from django.db import migrations, models
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0007_auto_20201127_1735'),
    ]

    operations = [
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 11, 29, 19, 39, 52, 367215, tzinfo=utc)),
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-12-08 19:04

import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0018_merge_20201207_1425'),
    ]

    operations = [
        migrations.AddField(
            model_name='professional',
            name='profile_picture',
            field=models.ImageField(blank=True, null=True, upload_to=''),
        ),
        migrations.AlterField(
            model_name='city',
            name='country',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cities', to='work_day.country'),
        ),
        migrations.AlterField(
            model_name='employment',
            name='offer',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='employments', to='work_day.joboffer'),
        ),
        migrations.AlterField(
            model_name='job',
            name='cv',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='jobs', to='work_day.curriculum'),
        ),
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 12, 9, 19, 4, 37, 960536, tzinfo=utc)),
        ),
        migrations.AlterField(
            model_name='joboffer',
            name='city',
            field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, related_name='job_offers', to='work_day.city'),
        ),
        migrations.AlterField(
            model_name='joboffer',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='job_offers', to='work_day.professional'),
        ),
        migrations.AlterField(
            model_name='professional',
            name='city',
            field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, related_name='professionals', to='work_day.city'),
        ),
        migrations.AlterField(
            model_name='study',
            name='cv',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='studies', to='work_day.curriculum'),
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-11-27 22:29

import datetime
from django.db import migrations, models
from django.utils.timezone import utc


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0004_auto_20201127_1715'),
    ]

    operations = [
        migrations.AlterField(
            model_name='job',
            name='finish_date',
            field=models.DateTimeField(default=datetime.datetime(2020, 11, 28, 22, 29, 6, 362692, tzinfo=utc)),
        ),
    ]
<file_sep># Generated by Django 3.1.2 on 2020-12-18 23:12

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import parler.fields
import parler.models


class Migration(migrations.Migration):

    dependencies = [
        ('work_day', '0023_auto_20201209_1207'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='chatroom',
            options={'verbose_name': 'Chat Room', 'verbose_name_plural': 'Chat Rooms'},
        ),
        migrations.AlterModelOptions(
            name='city',
            options={'verbose_name': 'City', 'verbose_name_plural': 'Cities'},
        ),
        migrations.AlterModelOptions(
            name='country',
            options={'verbose_name': 'Country', 'verbose_name_plural': 'Countries'},
        ),
        migrations.AlterModelOptions(
            name='curriculum',
            options={'verbose_name': 'Curriculum', 'verbose_name_plural': 'Curriculums'},
        ),
        migrations.AlterModelOptions(
            name='employment',
            options={'verbose_name': 'Employment', 'verbose_name_plural': 'Employments'},
        ),
        migrations.AlterModelOptions(
            name='job',
            options={'verbose_name': 'Job', 'verbose_name_plural': 'Jobs'},
        ),
        migrations.AlterModelOptions(
            name='joboffer',
            options={'verbose_name': 'Job Offer', 'verbose_name_plural': 'Job Offers'},
        ),
        migrations.AlterModelOptions(
            name='message',
            options={'verbose_name': 'Message', 'verbose_name_plural': 'Messages'},
        ),
        migrations.AlterModelOptions(
            name='profession',
            options={'verbose_name': 'Profession', 'verbose_name_plural': 'Professions'},
        ),
        migrations.AlterModelOptions(
            name='professional',
            options={'verbose_name': 'Professional', 'verbose_name_plural': 'Professionals'},
        ),
        migrations.AlterModelOptions(
            name='school',
            options={'verbose_name': 'School', 'verbose_name_plural': 'Schools'},
        ),
        migrations.AlterModelOptions(
            name='study',
            options={'verbose_name': 'Study', 'verbose_name_plural': 'Studies'},
        ),
        migrations.RemoveField(
            model_name='city',
            name='name',
        ),
        migrations.RemoveField(
            model_name='country',
            name='name',
        ),
        migrations.RemoveField(
            model_name='profession',
            name='description',
        ),
        migrations.RemoveField(
            model_name='profession',
            name='name',
        ),
        migrations.RemoveField(
            model_name='school',
            name='name',
        ),
        migrations.AlterField(
            model_name='country',
            name='creation_date',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Creation Date'),
        ),
        migrations.AlterField(
            model_name='employment',
            name='description',
            field=models.TextField(default='', max_length=200, verbose_name='Description'),
        ),
        migrations.AlterField(
            model_name='joboffer',
            name='description',
            field=models.CharField(default='', max_length=100, verbose_name='Description'),
        ),
        migrations.CreateModel(
            name='SchoolTranslation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')),
                ('name', models.CharField(max_length=200, verbose_name='Name')),
                ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='work_day.school')),
            ],
            options={
                'verbose_name': 'School Translation',
                'db_table': 'work_day_school_translation',
                'db_tablespace': '',
                'managed': True,
                'default_permissions': (),
                'unique_together': {('language_code', 'master')},
            },
            bases=(parler.models.TranslatedFieldsModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='ProfessionTranslation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')),
                ('name', models.CharField(max_length=50, verbose_name='Name')),
                ('description', models.CharField(default='', max_length=100, verbose_name='Description')),
                ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='work_day.profession')),
            ],
            options={
                'verbose_name': 'Profession Translation',
                'db_table': 'work_day_profession_translation',
                'db_tablespace': '',
                'managed': True,
                'default_permissions': (),
                'unique_together': {('language_code', 'master')},
            },
            bases=(parler.models.TranslatedFieldsModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='CountryTranslation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')),
                ('name', models.CharField(max_length=40, verbose_name='Name')),
                ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='work_day.country')),
            ],
            options={
                'verbose_name': 'Country Translation',
                'db_table': 'work_day_country_translation',
                'db_tablespace': '',
                'managed': True,
                'default_permissions': (),
                'unique_together': {('language_code', 'master')},
            },
            bases=(parler.models.TranslatedFieldsModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='CityTranslation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')),
                ('name', models.CharField(max_length=50, verbose_name='Name')),
                ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='work_day.city')),
            ],
            options={
                'verbose_name': 'City Translation',
                'db_table': 'work_day_city_translation',
                'db_tablespace': '',
                'managed': True,
                'default_permissions': (),
                'unique_together': {('language_code', 'master')},
            },
            bases=(parler.models.TranslatedFieldsModelMixin, models.Model),
        ),
    ]
<file_sep>from time import sleep

from .base_test_case import SeleniumBaseTestCase


class LoginTest(SeleniumBaseTestCase):
    def setUp(self) -> None:
        super().setUp()
        self.driver.get("http://127.0.0.1:8000/login/")

    def test_verify_login_with_valid_inputs(self):
        self.driver.find_element_by_xpath(
            "//*[@id='id_username']").send_keys('nur1234')
        self.driver.find_element_by_xpath(
            "//input[@id='id_password']").send_keys('shamas5432')
        self.driver.find_element_by_xpath(
            "//button[contains(text(),'Sign In')]").click()
        self.assertEqual(
            self.driver.current_url, 'http://127.0.0.1:8000/home/'
        )

    def test_verify_login_with_invalid_inputs(self):
        self.driver.find_element_by_xpath(
            "//*[@id='id_username']").send_keys('<PASSWORD>')
        self.driver.find_element_by_xpath(
            "//input[@id='id_password']").send_keys('<PASSWORD>')
        self.driver.find_element_by_xpath(
            "//button[contains(text(),'Sign In')]").click()
        self.assertEqual(
            self.driver.current_url, 'http://127.0.0.1:8000/login/'
        )

    def test_verify_login_with_empty_inputs(self):
        self.driver.find_element_by_xpath(
            "//*[@id='id_username']").send_keys('')
        self.driver.find_element_by_xpath(
            "//input[@id='id_password']").send_keys('')
        self.driver.find_element_by_xpath(
            "//button[contains(text(),'Sign In')]").click()
        self.assertEqual(
            self.driver.current_url, 'http://127.0.0.1:8000/login/'
        )

    def test_verify_password_recover_link(self):
        self.driver.find_element_by_xpath(
            "/html/body/div/div/div[2]/p[2]/a").click()
        self.assertEqual(
            self.driver.current_url, 'http://127.0.0.1:8000/resetPassword/'
        )

    def test_verify_register_link(self):
        self.driver.find_element_by_xpath(
            "/html/body/div/div/div[2]/p[3]/a").click()
        self.assertEqual(
            self.driver.current_url, 'http://127.0.0.1:8000/register/'
        )<file_sep>from django.contrib import admin
from parler.admin import TranslatableAdmin
from .models import *
# Register your models here.


@admin.register(Country)
class CountryAdmin(TranslatableAdmin):
    list_display = ('name', 'creation_date')


@admin.register(City)
class CityAdmin(TranslatableAdmin):
    list_display = ('name', 'country')


@admin.register(School)
class SchoolAdmin(TranslatableAdmin):
    list_display = ('name', 'city')


@admin.register(Profession)
class ProfessionAdmin(TranslatableAdmin):
    list_display = ('name', 'description')


@admin.register(Professional)
class ProfessionalAdmin(admin.ModelAdmin):
    list_display = (
        'user', 'city', 'birthdate', 'phone', 'id', 'status', 'creation_date'
    )


@admin.register(Curriculum)
class CurriculumAdmin(admin.ModelAdmin):
    list_display = ('owner', 'contract_price', 'score')


@admin.register(Job)
class JobAdmin(admin.ModelAdmin):
    list_display = ('description', 'cv', 'profession', 'start_date', 'finish_date')


@admin.register(JobOffer)
class JobOfferAdmin(admin.ModelAdmin):
    list_display = ('user', 'city', 'description', 'creation_date', 'status')


@admin.register(Employment)
class EmploymentAdmin(admin.ModelAdmin):
    list_display = ('offer', 'profession', 'description', 'reward', 'status')


@admin.register(Study)
class StudyAdmin(admin.ModelAdmin):
    list_display = ('cv', 'school', 'profession', 'name')


@admin.register(ChatRoom)
class ChatRoomAdmin(admin.ModelAdmin):
    list_display = ('creation_date', 'status')


@admin.register(Message)
class MessageAdmin(admin.ModelAdmin):
    list_display = ('chat_room', 'user', 'message', 'creation_date')
<file_sep>from time import sleep

from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


from .base_test_case import SeleniumBaseTestCase
from ..pages.register_page import RegisterPage


class RegisterTest(SeleniumBaseTestCase):

    def setUp(self) -> None:
        super().setUp()
        self.page = RegisterPage(self.driver)
        self.driver.get("http://127.0.0.1:8000/register/")

    def fill_register_inputs(self):
        self.page.get_email_input().send_keys('<EMAIL>')
        self.page.get_username_input().send_keys('myTestUsername')
        self.page.get_password_input().send_keys('<PASSWORD>')
        self.page.get_password2_input().send_keys('<PASSWORD>')
        self.page.get_firstname_input().send_keys('MyNameTest')
        self.page.get_lastname_input().send_keys('LastNameTest')
        self.page.get_profile_picture_input().send_keys(
            '/home/jhose/Nueva Carpeta/profile_photo.jpg'
        )
        select_city = Select(self.page.get_city_select())
        select_city.select_by_index(0)
        self.page.get_phone_input().send_keys('999999999')
        self.page.get_id_number_input().send_keys('12345678')
        self.page.get_id_photo_input().send_keys(
            '/home/jhose/Nueva Carpeta/id_card_photo.jpg'
        )
        sleep(3)

    def test_register_with_valid_inputs(self):
        self.fill_register_inputs()
        self.page.get_register_button().click()
        self.assertEqual(
            self.driver.current_url, 'http://127.0.0.1:8000/login/'
        )

    def test_register_with_blank_inputs(self):
        self.page.get_register_button().click()
        email_username = WebDriverWait(self.driver, 3).until(
            EC.element_to_be_clickable(
                (By.CSS_SELECTOR,
                 "input.cell.small-21.form-text.required#edit-name[name='name']")
            )
        )
        print(email_username.get_attribute("validationMessage"))
        self.assertEqual(
            self.driver.current_url, "http://127.0.0.1:8000/register/"
        )

