Use of ._meta Django

django, python

Solution

`_meta` as the name implies stores the meta data of the model. Say, you want to loop over all the fields of a model, then you can use `model._meta.get_fields()`.

By the way, meta options are covered in the documentation -

Model Meta options documentation

Problem

I want to ask about the use of ._meta in this code ? I didn't find a documentation that explains the use of .meta ``` def resend_activation_email(self, request, queryset): """ Re-sends activation emails for the selected users. Note that this will *only* send activation emails for users who are eligible to activate; emails will not be sent to users whose activation keys have expired or who have already activated. """ if Site._meta.installed: site = Site.objects.get_current() else: site = RequestSite(request) for profile in queryset: if not profile.activation_key_expired(): profile.send_activation_email(site) resend_activation_email.short_description = _("Re-send activation emails") ```

Original source