Opened 4 years ago

Last modified 4 years ago

#31434 closed New feature

Enhancement in the default __str__() function. — at Initial Version

Reported by: Chinmoy Owned by: Chinmoy
Component: Database layer (models, ORM) Version: 3.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The default str() function provides a rather impractical output and almost every time the developer has to change it to get the summary of the model. I suggest a more elaborate default str() function which outputs the field names with their datatypes(A skeletal schema).Maybe it could also print the complete data with the field name and their values?
This is an example of what it could output.


<QuerySet [
<Question: (<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: question_text>, <django.db.models.fields.DateTimeField: pub_date>) object (1)> ]>


Change History (1)

by Chinmoy, 4 years ago

Attachment: modelpreview.png added

An example screenshot of the str() output

Note: See TracTickets for help on using tickets.
Back to Top