Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output from model_to_dict (for example), I would like an output like that of ipython #537

Open
jpsala opened this issue Apr 18, 2023 · 0 comments

Comments

@jpsala
Copy link

jpsala commented Apr 18, 2023

Hello, I think that this is not really an issue, but I don't know for sure, so...
When using django with ipython, this command give me this output:

In [3]: model_to_dict(AccountRequest.objects.first().supervisor)
Out[3]:
{'id': 114746,
'business_title': 'Director Software Systems',
'first_name': 'Ernest',
'last_name': 'Ostro',
'username': 'ErnestOs_DELETED',
'user_principal_name': '@.org',
'email': '@',
'personal_email': None,
'employee_type': 1,
'start_date': datetime.datetime(2014, 3, 31, 0, 0),
'contract_end_date': None,
'department': None,
'csDepartment': 405,
'primary_business_unit': 44,
'location': 375,
...
But with ptpython the result is less readable, much difficult to find a field:

model_to_dict(AccountRequest.objects.first().supervisor)
{'id': 114746, 'business_title': 'Director Software Systems', 'first_name': 'Ernest', 'last_name': 'Ostro', 'username': 'ErnestOs_DELETED', 'user_principal_name': '@', 'email': '@', 'personal_email': None, 'employee_type': 1, 'start_date': datetime.datetime(2014, 3, 31, 0, 0), 'contract_end_date': None, 'department': None, 'csDepartment': 405, 'primary_business_unit': 44, 'location': 375, 't1': None, 't3': None, 't5': 169, 'phone_number': None, 'employment_status': None, 'workday_country_program': None, 'supervisor': 122013, 'display_name': 'Ernest Ostro', 'ad_object_id': '2a29ce33-109e-4406-8cc3-b26beb57ac65', 'cs_object_id': 1969, 'wd_object_id': '052068', 'integra_object_id': '114746', 'last_ad_sync_date': datetime.datetime(2019, 5, 28, 20, 15, 15, tzinfo=datetime.timezone.utc), 'last_cs_sync_date': None, 'last_integra_sync_date': None, 'active': False, 'preferred_first_name': 'Ernest', 'preferred_last_name': 'Ostro', 'bussines_address_line_1': '122 East 42nd Street', 'bussines_address_line_2': '12th Floor', 'bussines_address_city': 'New York', 'bussines_address_state_prov': 'NY', 'bussines_address_postal_code': '10168', 'position_id': None, 'job_title': None, 'original_hire_date': datetime.datetime(2014, 3, 31, 0, 0, tzinfo=datetime.timezone.utc), 'rehired_employee': False, 'termination_date': datetime.datetime(2019, 5, 28, 0, 0), 'marked_for_termination': None, 'original_account': None, 'updated_by': None, 'it_account_status': False, 'secondary_business_unit': [<OrganizationalUnit: Project Management>]}

Is there a way to get a similar result using ptpython?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant