Skip to content

Commit

Permalink
Merge pull request #1858 from gtech-mulearn:dev
Browse files Browse the repository at this point in the history
[MINOR] Some minor changes
  • Loading branch information
MZaFaRM authored Dec 26, 2023
2 parents 47427be + 4c7ea2b commit a179a00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
6 changes: 2 additions & 4 deletions api/dashboard/roles/dash_roles_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class RoleAssignmentSerializer(serializers.Serializer):

role = serializers.PrimaryKeyRelatedField(queryset=Role.objects.all())
users = serializers.ListField(child=serializers.UUIDField())
created_by = serializers.PrimaryKeyRelatedField(
queryset=User.objects.all())
created_by = serializers.PrimaryKeyRelatedField(queryset=User.objects.all())

def validate(self, attrs):
data = super().validate(attrs)
Expand All @@ -39,8 +38,7 @@ def validate(self, attrs):
~Q(user_role_link_user__role=data["role"]), pk__in=attrs
)
if users.count() != len(attrs):
raise serializers.ValidationError(
"One or more user IDs are invalid.")
raise serializers.ValidationError("One or more user IDs are invalid.")

data["users"] = users
return data
Expand Down
16 changes: 7 additions & 9 deletions db/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,13 @@ class Meta:


class College(models.Model):
id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4())
level = models.IntegerField(default=0)
org = models.ForeignKey(Organization, on_delete=models.CASCADE, related_name='college_org', unique=True)
updated_by = models.ForeignKey(User, on_delete=models.SET(settings.SYSTEM_ADMIN_ID), db_column='updated_by',
related_name='college_updated_by')
updated_at = models.DateTimeField(auto_now=True)
created_by = models.ForeignKey(User, on_delete=models.SET(settings.SYSTEM_ADMIN_ID), db_column='created_by',
related_name='college_created_by')
created_at = models.DateTimeField(auto_now_add=True)
id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4())
level = models.IntegerField(default=0)
org = models.OneToOneField(Organization, on_delete=models.CASCADE, related_name='college_org')
updated_by = models.ForeignKey(User, on_delete=models.SET(settings.SYSTEM_ADMIN_ID), db_column='updated_by', related_name='college_updated_by')
updated_at = models.DateTimeField(auto_now=True)
created_by = models.ForeignKey(User, on_delete=models.SET(settings.SYSTEM_ADMIN_ID), db_column='created_by', related_name='college_created_by')
created_at = models.DateTimeField(auto_now_add=True)

class Meta:
managed = False
Expand Down

0 comments on commit a179a00

Please sign in to comment.