Feature/bo establishment employee features
This commit is contained in:
parent
17f67d020a
commit
1711057cee
|
|
@ -162,7 +162,7 @@ class ContactEmailBackSerializers(model_serializers.PlateSerializer):
|
|||
class EmployeeBackSerializers(serializers.ModelSerializer):
|
||||
"""Employee serializers."""
|
||||
|
||||
awards = AwardSerializer(many=True)
|
||||
awards = AwardSerializer(many=True, read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = models.Employee
|
||||
|
|
@ -209,6 +209,7 @@ class EstablishmentEmployeeBackSerializer(serializers.ModelSerializer):
|
|||
'from_date',
|
||||
'to_date',
|
||||
'position',
|
||||
'status',
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,4 +54,5 @@ urlpatterns = [
|
|||
path('types/<int:pk>/', views.EstablishmentTypeRUDView.as_view(), name='type-rud'),
|
||||
path('subtypes/', views.EstablishmentSubtypeListCreateView.as_view(), name='subtype-list'),
|
||||
path('subtypes/<int:pk>/', views.EstablishmentSubtypeRUDView.as_view(), name='subtype-rud'),
|
||||
path('positions/', views.EstablishmentPositionListView.as_view(), name='position-list'),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -356,3 +356,12 @@ class EstablishmentEmployeeDeleteView(generics.DestroyAPIView):
|
|||
object_to_delete = self._get_object_to_delete(establishment_id, employee_id)
|
||||
object_to_delete.delete()
|
||||
return HttpResponse(status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class EstablishmentPositionListView(generics.ListAPIView):
|
||||
"""Establishment positions list view."""
|
||||
|
||||
pagination_class = None
|
||||
permission_classes = (permissions.AllowAny, )
|
||||
queryset = models.Position.objects.all()
|
||||
serializer_class = serializers.PositionBackSerializer
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from django.contrib.auth.models import AbstractUser
|
||||
|
||||
|
||||
def with_base_attributes(cls):
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ def with_base_attributes(cls):
|
|||
if request and hasattr(request, "user"):
|
||||
user = request.user
|
||||
|
||||
if user is not None:
|
||||
if user is not None and isinstance(user, AbstractUser):
|
||||
data.update({'modified_by': user})
|
||||
|
||||
if not self.instance:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user