def get(self, request, *args, **kwargs): user = Utility.get_data_or_none(UserProfile, request, **kwargs) if user is None: return Response({'detail': 'Not Found'}, status=status.HTTP_404_NOT_FOUND) else: profile = user.to_json(True) del profile['password'] return Response(profile)
def get(self, request, *args, **kwargs): instance = Utility.get_data_or_none(model, request, **kwargs) if instance is None: return Response({'detail': 'Not Found'}, status=status.HTTP_404_NOT_FOUND) else: serializer = VisitorGroupSerializer(instance) data = serializer.data row = nest_row(data) return Response(row)
def get(self, request, *args, **kwargs): user = Utility.get_data_or_none(UserProfile, request, **kwargs) if user is None: return Response({'detail': 'Not Found'}, status=status.HTTP_404_NOT_FOUND) else: serializer = UserSerializer(user) data = serializer.data del data['password'] row = nest_row(data) return Response(row)
def get(self, request, *args, **kwargs): instance = Utility.get_data_or_none(model, request, **kwargs) if instance is None: return Response({'detail': 'Not Found'}, status=status.HTTP_404_NOT_FOUND) else: row = instance.to_json(True) row['status'] = Appointments().get_status(row) logs = AppointmentLogs().get_logs(row.get('_id')) sorted_logs = sorted(logs, key=lambda k: k['created'], reverse=True) row['logs'] = sorted_logs if len(sorted_logs) > 0: row['latest'] = sorted_logs[0] return Response(row)
def get(self, request, *args, **kwargs): instance = Utility.get_data_or_none(model, request, **kwargs) if instance is None: return Response({'detail': 'Not Found'}, status=status.HTTP_404_NOT_FOUND) else: return Response(instance.to_json(True))