Я создал форму, но из-за проблемы с выравниванием я пытаюсь настроить себя в своем шаблоне,
Forms.py
class VolunteerForm(forms.ModelForm):
volposition = forms.CharField(label="Volunteer Position")
roledesc = forms.CharField(label="Role Description")
noofhours = forms.IntegerField(label="Time requirements")
Qualreqt = forms.CharField(label="Qualifications and Requirements")
class Meta:
model = Volunteer
views.py
def volunteer_page(request):
#import pdb
pdb.set_trace()
if request.method == 'POST':
form = VolunteerForm(request.POST)
if form.is_valid():
f = form.save(commit=False)
f.save()
message = "Position added"
return HttpResponseRedirect('.')
else:
form = VolunteerForm()
variable = RequestContext(request,{'form':form})
return render_to_response('registration/volunteer.html',variable)
Volunteer.html
{% extends "base.html" %}
{% block title %}User Registration{% endblock %}
{% block head %}User Registration{% endblock %}
{% block content %}
<form method="post" action".">
<table border="0">
<tr>
{{ form.non_field_errors }}
<div class="fieldWrapper">
{{ form.volposition.errors }}
<th><label for="id_volposition">Volunteer Position</label></th>
<th>{{ form.volposition }}<maxlength="100"></th>
</div>
</tr>
<tr>
<div class="fieldWrapper">
{{ form.roledesc.errors }}
<th><label for="id_roledesc">Role Description:</label></th>
<th>{{ form.roledesc }}</th>
</div>
</tr>
<tr>
<div class="fieldWrapper">
{{ form.noofhours.errors }}
<th><label for="id_noofhours">Number of Hours:</label></th>
<th>{{ form.noofhours }}</th>
</div>
</tr>
<tr>
<div class="fieldWrapper">
{{ form.qualreqt.errors }}
<th><label for="id_qualreqt">Qualification and Requirements</label></th>
<th>{{ form.Qualreqt }}</th>
</div>
</tr>
</table>
<input type="submit" value="register" />
</form>
{% endblock %}
Описание роли и квалификации / требования должны иметь намного большую текстовую область по сравнению с html, сгенерированным этой страницей
Какими будут мои изменения?