0

When i my render my forms.py to my html file does not fit (responsive) entirely on screen

forms.py -

class RegisterUserForm(forms.Form):
      username = forms.CharField(min_length=6, widget=forms.TextInput(attrs={'class': 'form-control'}))
      email = forms.EmailField(widget=forms.EmailInput(attrs={'class': 'form-control'}))
      password = forms.CharField(min_length=8, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
      password2 = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control'}))
      photo = forms.ImageField(required=True)

if i try the site without forms, the page adapts to the screen, but when i add the form "{{form.as_p}}", doesn't work

HTML page -

<div class="panel panel-default">
<div class="panel-heading">
  <h2>User Register</h2>
</div>
<div class="panel-body">
<div class="row">
  <div class="col-md-6 col-sm-offset-3">
    <form role="form" action="" method="post">
      {% csrf_token %}
      {{form.as_p}}
    </form>
  </div>
 </div>
 <button type="submit" name="register" class="btn btn-primary"><span    class="glyphicon glyphicon-log-in"></span> Register</button>
</div>
<div class="panel-footer">
</div>
</div>

I need everything to be adaptive, how do i go about doing that?

pic1 pic2

1
  • Other than the duplicate which will give different ways of fixing this, I'm pretty sure your issues may also be related to the col-sm-offset, you shouldn't really need a grid inside the panel Commented Aug 12, 2016 at 6:29

1 Answer 1

1

Insert this code to head :

<meta name="viewport" content="width=device-width, initial-scale=1">
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.