class TaggedItem(models.Model):
tag = models.SlugField()
content_type = models.ForeignKey(ContentType,
on_delete=models.CASCADE, related_name='tagged_items')
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
>>> TaggedItem._meta.get_field('object_id')
<django.db.models.fields.PositiveIntegerField: object_id>
>>> TaggedItem._meta.get_field('content_type')
<django.db.models.fields.related.ForeignKey: content_type>
}}}
(`object_id` and `content_type` aren't hidden).
There's a related discussion in the
[https://github.com/django/django/blob/d4d79d0f200357b28419203557cc61c8168316ab/docs/ref/models/meta.txt#L79-L84
Options.get_fields() docs] that also needs some correction.
Another thing I noticed is that `Field.hidden` is
[https://github.com/django/django/blob/d4d79d0f200357b28419203557cc61c8168316ab/django/db/models/options.py#L792-L793
only consulted for relational fields]. Removing `Field.hidden` and
`GenericForeignKey.hidden` doesn't result in any crash of `get_fields()`
because those attributes are never consulted.
--
Ticket URL: <https://code.djangoproject.com/ticket/28011>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => cleopatra douglas
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/28011#comment:1>
* owner: nobody => Modestas Jakuska
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/28011#comment:1>
* owner: Modestas Jakuska => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/28011#comment:2>
* owner: nobody => Akshat verma
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/28011#comment:1>
Comment (by Mariusz Felisiak):
Akshat, are you going to work on any of these tickets? you've already
assigned many of them to yourself. I'd recommend to focus on a single one.
--
Ticket URL: <https://code.djangoproject.com/ticket/28011#comment:2>