Has a feature like this ever been considered?
If a model has no __unicode__, __str__ or __repr__ representation, then
maybe it could devise a string representation by collecting fields which
have this value set to True.
Example:
Without the feature:
class Person(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
>>> person = Person(first_name='Ben', last_name='Friedland')
>>> print person
<Person: Person object> # fairly useless object representation
This feature would work something like:
class Person(models.Model):
first_name = models.CharField(max_length=50, *repr_output=True*)
last_name = models.CharField(max_length=50, *repr_output=True*)
>>> person = Person(first_name='Ben', last_name='Friedland')
>>> print person
<Person: first_name='Ben', last_name='Friedland'> # includes fields
specified via repr_output=True
If this would be useful I'd be happy to formally create an issue and even
implement the feature.
Thanks!
Ben Friedland
www.bugben.com
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/ec667640-b82b-4d9e-a87a-b2dc705b5aa6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.