Commit df07e0d0 authored by John Red Medrano's avatar John Red Medrano

added company at module endpoint, allow null parent at departments

parent 29b239ac
from rest_framework import serializers from rest_framework import serializers
from app.entities.models import Department from app.entities.models import Department, Company
class DepartmentSerializer(serializers.ModelSerializer): class DepartmentSerializer(serializers.ModelSerializer):
def to_representation(self, instance):
company_name = Company.objects.filter(
id=instance.company.id
).values().first()
ret = super().to_representation(instance)
ret['company'] = company_name
# ret['application'] = application_name
return ret
class Meta: class Meta:
model = Department model = Department
fields = '__all__' fields = '__all__'
......
# Generated by Django 2.2 on 2019-09-10 16:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('entities', '0003_auto_20190910_0956'),
]
operations = [
migrations.AlterField(
model_name='module',
name='parent',
field=models.IntegerField(blank=True, null=True),
),
]
...@@ -57,7 +57,7 @@ class Module(AuditClass): ...@@ -57,7 +57,7 @@ class Module(AuditClass):
blank=True, blank=True,
null=True null=True
) )
parent = models.IntegerField() parent = models.IntegerField(blank=True, null=True)
sort_id = models.IntegerField() sort_id = models.IntegerField()
component = models.CharField( component = models.CharField(
max_length=255, max_length=255,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment