title: Click in a dropdown option and show an specific field in Django
body: <p>I have the following situation, I have this model: </p>
  
  <pre><code>class Profile(models.Model):
  
      DEVELOPER = 1
      MARKETER = 2
      ACADEMIC = 3
      INFLUENCER = 4
      COMMUNITY_MEMBER = 5
  
      ROLE_CHOICES = (
          (DEVELOPER, 'Developer'),
          (MARKETER, 'Marketer'),
          (ACADEMIC, 'Academic'),
          (INFLUENCER, 'Influencer'),
          (COMMUNITY_MEMBER, 'Community Member'),
      )
  
      user = models.OneToOneField(User)
      account_type = models.ForeignKey(AccountType, default=AccountType.FREE)
      role = models.PositiveIntegerField(choices=ROLE_CHOICES, null=True, blank=True)
      github_profile = models.URLField(blank=True, null=True)
      linkedin_profile = models.URLField(blank=True, null=True)
  </code></pre>
  
  <p>And now what I want to do is that if the user clicks in the dropwdown the <code>Developer</code> option, the github_profile should appear, otherwise it should keep hide.</p>
  
  <p>Right now, looks like this, and the Github Link fields should be hide: </p>
  
  <p><a href="https://i.stack.imgur.com/d8td1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d8td1.png" alt="enter image description here"></a></p>
  
  <p>And this is my html: </p>
  
  <pre><code>  &lt;div class="form-group select-wrapper"&gt;
      &lt;label for="role"&gt;What best describes you?&lt;/label&gt;
      &lt;select id="role" name="role" class="form-control"&gt;
        &lt;option selected&gt;Choose an option&lt;/option&gt;
        {% for index, value in roles_form.fields.roles.choices %}
            &lt;option value="{{ index }}"&gt;{{ value }}&lt;/option&gt;
        {% endfor %}
      &lt;/select&gt;
    &lt;span class="role-error hidden" style="color: red"&gt;&lt;/span&gt;
    &lt;/div&gt;
    &lt;div class="form-group"&gt;
        &lt;label for="github_profile"&gt;GitHub Profile (optional)&lt;/label&gt;
        &lt;input type="url" class="form-control" name="github_profile" id="github_profile" placeholder="https://github.com/your-profile"&gt;
        &lt;span class="github_profile-error hidden" style="color: red"&gt;&lt;/span&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>I know this is a conditional thing, however I'm brand new in Django and I'm not pretty sure how to achieve it.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I did the following function: </p>
  
  <pre><code>$('select').on('change', function() {
  
            var value = $(this).val();
            if (value == 1) {
               $('#github_link').show();
            } else if (value != 1) {
               $('#github_link').hide();
            }
    })
  </code></pre>
  
  <p>It works but I got the following feedback: Here you have hardcoded the value "1", but if the positioning on this list changes, then this behavior will break. Instead, you should reference the variable {{ model.profile.DEVELOPER }} which will yield the current value of the variable DEVELOPER, even if it changes.</p>