Django userena check if mugshot is set
<p>Ok so this is the models.py of userena. Can i check using template tags in html if mugshot is set? The first if statement checks if the mugshot is uploaded.</p>

<pre><code>def get_mugshot_url(self):
    """
    Returns the image containing the mugshot for the user.

    The mugshot can be a uploaded image or a Gravatar.

    Gravatar functionality will only be used when
    ``USERENA_MUGSHOT_GRAVATAR`` is set to ``True``.

    :return:
        ``None`` when Gravatar is not used and no default image is supplied
        by ``USERENA_MUGSHOT_DEFAULT``.

    """
    # First check for a mugshot and if any return that.
    if self.mugshot:
        return self.mugshot.url

    # Use Gravatar if the user wants to.
    if userena_settings.USERENA_MUGSHOT_GRAVATAR:
        return get_gravatar(self.user.email,
                            userena_settings.USERENA_MUGSHOT_SIZE,
                            userena_settings.USERENA_MUGSHOT_DEFAULT)

    # Gravatar not used, check for a default image.
    else:
        if userena_settings.USERENA_MUGSHOT_DEFAULT not in ['404', 'mm',
                                                            'identicon',
                                                            'monsterid',
                                                            'wavatar']:
            return userena_settings.USERENA_MUGSHOT_DEFAULT
        else:
            return None
</code></pre>

<p>You could simply replicate the first <code>if</code> statement in the template on the user profile's instance. Something like</p>

<pre><code>{% if profile.mugshot %}
  profile.mugshot.url
{% endif %}
</code></pre>

python django