Development (#128)

* [UPDT] RECRUITMENT: Updated recruitment stage update method by changing hx-target

* [UPDT] LEAVE: Updated company leave create , update and delete method by adding hx-target

* [UPDT] ATTENDANCE: Updated attendance request create method by changing hx-target

* [UPDT] LEAVE: Updated leave request create form hx-target

* [IMP] Add HorillaModel abstract model

* [UPDT] EMPLOYEE: Updated employee disciplinary form by adding parent model class for disciplinary model
This commit is contained in:
Horilla
2024-03-21 08:38:16 +00:00
committed by GitHub
parent 5dff8d821a
commit d09e9b4946
34 changed files with 639 additions and 1037 deletions

22
horilla/models.py Normal file
View File

@@ -0,0 +1,22 @@
from django.db import models
from django.contrib.auth.models import User
class HorillaModel(models.Model):
created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True)
created_by = models.ForeignKey(
User, on_delete=models.SET_NULL, null=True, blank=True, editable=False
)
is_active = models.BooleanField(default=True)
class Meta:
abstract = True
def save(self, *args, **kwargs):
request = kwargs.get("request", None)
if request and not self.pk:
user = request.user
if user.is_authenticated:
self.created_by = user
request = kwargs.pop("request", None)
super(HorillaModel, self).save(*args, **kwargs)