Hello everyone

I have the following Profile model

class Profile(models.Model):
    user = models.OneToOneField(User, related_name='profile')    
    quadrant1 = models.IntegerField(default=1)
    quadrant2 = models.IntegerField(default=1)
    quadrant3 = models.IntegerField(default=1)
    quadrant4 = models.IntegerField(default=1)


and I want in a template to mark a quadrant option as selected in the 
following code

{% for quadrant in priority_groups %}
     <select name="quadrant{{ quadrant.id }}"
        onchange="$('#quadrant-form').submit()">
    {% for option in quadrant.quadrant.all %}
          <option value="{{ option.id }}"
            {% if user_profile.quadrant1 == option.id %}
                 selected
            {% endif %}
          >
            {{ option }}
           </option>
      {% endfor %}
     </select>
{% endfor %}

but I can't and I can't find a solution either.
Any advice on how I should store those settings so I can easily mark the 
option as selected in template? 

hope my question is understandable enough 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13544e2d-1add-415c-a9ae-dcbf5d34645b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to