9# added urls

This commit is contained in:
Eligiusz Kurzawa 2021-01-06 19:07:42 +01:00
parent e159892f44
commit e3140edfd4
5 changed files with 37 additions and 9 deletions

View File

@ -39,6 +39,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'jobs',
'users',
'ckeditor',
]
AUTH_USER_MODEL = 'users.Account'
@ -136,3 +137,11 @@ MEDIA_URL = '/media/'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/users/login/'
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'Basic',
'height': 300,
'width': 400,
},
}

View File

@ -33,19 +33,21 @@
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark ftco-navbar-light" id="ftco-navbar">
<div class="container">
<a class="navbar-brand" href="index.html">JobPortal</a>
<a class="navbar-brand" href="{% url 'jobs:home' %}">JobPortal</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-label="Toggle navigation">
<span class="oi oi-menu"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav ml-auto">
<li class="nav-item active"><a href="index.html" class="nav-link">Home</a></li>
<li class="nav-item active"><a href="{% url 'jobs:home' %}" class="nav-link">Home</a></li>
<li class="nav-item"><a href="about.html" class="nav-link">About</a></li>
<li class="nav-item"><a href="blog.html" class="nav-link">Blog</a></li>
<li class="nav-item"><a href="contact.html" class="nav-link">Contact</a></li>
<li class="nav-item cta mr-md-2"><a href="new-post.html" class="nav-link">Post a Job</a></li>
<li class="nav-item cta cta-colored"><a href="job-post.html" class="nav-link">Want a Job</a></li>
{% if not user.is_authenticated %}
<li class="nav-item cta mr-md-2"><a href="{% url 'users:register' %}" class="nav-link">Register</a></li>
<li class="nav-item cta cta-colored"><a href="{% url 'users:login' %}" class="nav-link">Login</a></li>
{% endif %}
</ul>
</div>

View File

@ -6,7 +6,7 @@
<div class="container">
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Post a Job</span></p>
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Login</span></p>
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Login</h1>
</div>
</div>

View File

@ -6,8 +6,8 @@
<div class="container">
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Post a Job</span></p>
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Post a Job</h1>
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Register</span></p>
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Register</h1>
</div>
</div>
</div>

View File

@ -1,8 +1,11 @@
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
from django.contrib.auth.models import PermissionsMixin
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.translation import gettext_lazy as _
from PIL import Image
from ckeditor.fields import RichTextField
class UserManager(BaseUserManager):
@ -50,10 +53,10 @@ class Account(AbstractBaseUser, PermissionsMixin):
class Profile(models.Model):
user = models.OneToOneField(Account, on_delete=models.CASCADE, related_name="profile")
image = models.ImageField(upload_to="media/users")
image = models.ImageField(upload_to="media/users", default="media/users/person_1.jpg")
birth_day = models.DateField(default=None, blank=True, null=True)
location = models.CharField(max_length=100, blank=True)
resume = models.TextField(blank=True)
resume = RichTextField(blank=True)
company = models.CharField(max_length=250, blank=True)
def __str__(self):
@ -66,3 +69,17 @@ class Profile(models.Model):
new_size = (200, 200)
img.thumbnail(new_size)
img.save(self.image.path)
@receiver(models.signals.post_save, sender=Account)
def post_save_user_signal(sender, instance, created, **kwargs):
if created:
instance.save()
def create_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
post_save.connect(create_user_profile, sender=Account)