{% comment %} This fragment renders a friend code selector used for filtering or form submissions. Expected variables: - friend_codes: A list or QuerySet of FriendCode objects. - selected_friend_code (optional): The currently selected FriendCode. If not provided, the user's default friend code is used. - field_name (optional): The name/id for the input element (default "friend_code"). - label (optional): The label text (default None). {% endcomment %} {% with field_name=field_name|default:"friend_code" label=label|default:"" %} {% with effective_friend_code=selected_friend_code|default:request.user.default_friend_code %} {% if friend_codes|length > 1 %}
{% if label and label != "" %} {% endif %}
{% else %} {% endif %} {% endwith %} {% endwith %}