I have created a WTform in Python Flask, where I have a delivery form. If customer's billing address is different from delivery address then i am enabling div which contains fields for billing address. I am doing hiding and showing of div via jquery.
Originally i had all the fields in one Flaskform, but then i thought if i put billing fields in separate FlaskForm, and handle form.validate_on_submit() separately for 2nd form then may be i can skip validation for fields in Billing div.
But no, it is still performing validation on those fields, and because of that I am not able to move forward. If user has same addresses then billing fields will be empty and can't pass validation.
I am sure people must have encountered this situation but i can't find any answer regarding this.
Could someone guide me?
I am attaching code, to explain myself.
My Forms.py
class DeliveryForm(FlaskForm):
choices_billadd = [('1', 'Use delivery address'), ('2', 'Add a billing address')]
addressline1 = StringField('Address Line 1*',
validators=[DataRequired(), Length(min=1, max=100)])
addressline2 = StringField('Address Line 2',
validators=[Length(max=100)])
city = StringField('City*',
validators=[DataRequired(), Length(min=2, max=50)])
postcode = StringField('Postcode*',
validators=[DataRequired(), Length(min=2, max=50)])
billingaddress = SelectField('Billing Address*', choices = choices_billadd, validators = [DataRequired()])
submit = SubmitField('Submit')
class BillingForm(FlaskForm):
bill_addressline1 = StringField('Address Line 1*',
validators=[DataRequired(), Length(min=1, max=100)])
bill_addressline2 = StringField('Address Line 2',
validators=[Length(max=100)])
bill_city = StringField('City*',
validators=[DataRequired(), Length(min=2, max=50)])
bill_postcode = StringField('Postcode*',
validators=[DataRequired(), Length(min=2, max=50)])
<form method="POST" action="">
{{ form.csrf_token(id='login_csrf') }}
<fieldset class="form-group content-section">
<div class="row pt-3">
<div class="col-6">
{{ form.addressline1.label(class="form-control-label") }}
{% if form.addressline1.errors %}
{{ form.addressline1(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form.addressline1.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.addressline1(class="form-control") }}
{% endif %}
</div>
<div class="col-6">
{{ form.addressline2.label(class="form-control-label") }}
{% if form.addressline2.errors %}
{{ form.addressline2(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form.addressline2.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.addressline2(class="form-control") }}
{% endif %}
</div>
</div>
<div class="row pt-3">
<div class="col-6">
{{ form.city.label(class="form-control-label") }}
{% if form.city.errors %}
{{ form.city(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form.city.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.city(class="form-control") }}
{% endif %}
</div>
<div class="col-6">
{{ form.postcode.label(class="form-control-label") }}
{% if form.postcode.errors %}
{{ form.postcode(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form.postcode.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.postcode(class="form-control") }}
{% endif %}
</div>
</div>
<div class="row pt-3">
<div class="col-12">
{{ form.billingaddress.label(class="form-control-label") }}
{{ form.billingaddress(class="form-control") }}
</div>
</div>
<div id="div_billingaddress" class="">
<div class="row pt-3">
<div class="col-6">
{{ form_bill.bill_addressline1.label(class="form-control-label") }}
{% if form_bill.bill_addressline1.errors %}
{{ form_bill.bill_addressline1(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form_bill.bill_addressline1.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form_bill.bill_addressline1(class="form-control") }}
{% endif %}
</div>
<div class="col-6">
{{ form_bill.bill_addressline2.label(class="form-control-label") }}
{% if form_bill.bill_addressline2.errors %}
{{ form_bill.bill_addressline2(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form_bill.bill_addressline2.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form_bill.bill_addressline2(class="form-control") }}
{% endif %}
</div>
</div>
<div class="row pt-3">
<div class="col-6">
{{ form_bill.bill_city.label(class="form-control-label") }}
{% if form_bill.bill_city.errors %}
{{ form_bill.bill_city(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form_bill.bill_city.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form_bill.bill_city(class="form-control") }}
{% endif %}
</div>
<div class="col-6">
{{ form_bill.bill_postcode.label(class="form-control-label") }}
{% if form_bill.bill_postcode.errors %}
{{ form_bill.bill_postcode(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form_bill.bill_postcode.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form_bill.bill_postcode(class="form-control") }}
{% endif %}
</div>
</div>
</div>
</fieldset>
<div class="row py-4">
<div class="col-12">
{{ form.submit(class="btn btn-success btn-block") }}
</div>
</div>
</form>
Related
On the category page, the sub-category are getting repeated in refine search. I have added categories and sub-categories. I have 3 level categories i.e Phone-cases(Parent)->Apple(Sub-category)->iPhone X(Sub-category of apple).
Screenshot:
<?php
{{ header }}
<div id="product-category" class="container">
<ul class="breadcrumb">
{% for breadcrumb in breadcrumbs %}
<li>{{ breadcrumb.text }}</li>
{% endfor %}
</ul>
<div class="row">
{{ column_left }}
{% if column_left and column_right %}
{% set class = 'col-sm-6' %}
{% elseif column_left or column_right %}
{% set class = 'col-sm-9' %}
{% else %}
{% set class = 'col-sm-12' %}
{% endif %}
<div id="content" class="{{ class }}">
{{ content_top }}
<h2>{{ heading_title }}</h2>
{% if thumb or description %}
<div class="row">
{% if thumb %}<div class="col-sm-2"><img src="{{ thumb }}" alt="{{ heading_title }}" title="{{ heading_title }}" class="img-thumbnail" /></div>
{% endif %}
{% if description %}<div class="col-sm-10">{{ description }}</div>
{% endif %}</div>
<hr>
{% endif %}
{% if categories %}
<h3>{{ text_refine }}</h3>
{% if categories|length <= 5 %}
<div class="row">
<div class="col-sm-3">
<ul>
{% for category in categories %}
<li>{{ category.name }}</li>
{% endfor %}
</ul>
</div>
</div>
{% else %}
<div class="row">
{% for category in categories|batch((categories|length / 4)|round(1, 'ceil')) %}
<div class="col-sm-3">
<ul>
{% for child in category %}
<li>{{ child.name }}</li>
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
<br />
{% endif %}
{% endif %}
{% if products %}
<div class="row">
<div class="col-md-2 col-sm-6 hidden-xs">
<div class="btn-group btn-group-sm">
<button type="button" id="list-view" class="btn btn-default" data-toggle="tooltip" title="{{ button_list }}"><i class="fa fa-th-list"></i></button>
<button type="button" id="grid-view" class="btn btn-default" data-toggle="tooltip" title="{{ button_grid }}"><i class="fa fa-th"></i></button>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="form-group">{{ text_compare }}
</div>
</div>
<div class="col-md-4 col-xs-6">
<div class="form-group input-group input-group-sm">
<label class="input-group-addon" for="input-sort">{{ text_sort }}</label>
<select id="input-sort" class="form-control" onchange="location = this.value;">
{% for sorts in sorts %}
{% if sorts.value == '%s-%s'|format(sort, order) %}
<option value="{{ sorts.href }}" selected="selected">{{ sorts.text }}</option>
{% else %}
<option value="{{ sorts.href }}">{{ sorts.text }}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div class="col-md-3 col-xs-6">
<div class="form-group input-group input-group-sm">
<label class="input-group-addon" for="input-limit">{{ text_limit }}</label>
<select id="input-limit" class="form-control" onchange="location = this.value;">
{% for limits in limits %}
{% if limits.value == limit %}
<option value="{{ limits.href }}" selected="selected">{{ limits.text }}</option>
{% else %}
<option value="{{ limits.href }}">{{ limits.text }}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
</div>
<div class="row">
{% for product in products %}
<div class="product-layout product-list col-xs-12">
<div class="product-thumb">
<div class="image"><img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive" /></div>
<div>
<div class="caption">
<h4>{{ product.name }}</h4>
<p>{{ product.description }}</p>
{% if product.price %}
<p class="price">
{% if not product.special %}
{{ product.price }}
{% else %}
<span class="price-new">{{ product.special }}</span>
<span class="price-old">{{ product.price }}</span>
{% endif %}
{% if product.tax %}
<span class="price-tax">{{ text_tax }} {{ product.tax }}</span>
{% endif %}
</p>
{% endif %}
{% if product.rating %}
<div class="rating">
{% for i in 1..5 %}
{% if product.rating < i %}
<span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
{% else %} <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
<div class="button-group">
<button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md">{{ button_cart }}</span></button>
<button type="button" data-toggle="tooltip" title="{{ button_wishlist }}" onclick="wishlist.add('{{ product.product_id }}');"><i class="fa fa-heart"></i></button>
<button type="button" data-toggle="tooltip" title="{{ button_compare }}" onclick="compare.add('{{ product.product_id }}');"><i class="fa fa-exchange"></i></button>
</div>
</div>
</div>
</div>
{% endfor %} </div>
<div class="row">
<div class="col-sm-12 text-left">{{ pagination }}</div>
{# <div class="col-sm-6 text-right">{{ results }}</div> #}
</div>
{% endif %}
{% if not categories and not products %}
<p>{{ text_empty }}</p>
<div class="buttons">
<div class="pull-right">{{ button_continue }}</div>
</div>
{% endif %}
{{ content_bottom }}</div>
{{ column_right }}</div>
</div>
{{ footer }}
Okay, this looks the relevant piece.
{% if categories %}
<h3>{{ text_refine }}</h3>
{% if categories|length <= 5 %}
<div class="row">
<div class="col-sm-3">
<ul>
{% for category in categories %}
<li>{{ category.name }}</li>
{% endfor %}
</ul>
</div>
</div>
{% else %}
<div class="row">
{% for category in categories|batch((categories|length / 4)|round(1, 'ceil')) %}
<div class="col-sm-3">
<ul>
{% for child in category %}
<li>{{ child.name }}</li>
{% endfor %}
</ul>
</div>
{% endfor %}</div>
<br />
{% endif %}
{% endif %}
You have the else triggering I think, as you have more than 5 categories.
As you can see, the child in that category gets printed instead of the category that you're trying to trigger. Rather remove the if/else and loop straight through the categories. Each of your children falls under multiple categories as well, therefore duplication.
{% if categories %}
<h3>{{ text_refine }}</h3>
<div class="row">
<div class="col-sm-3">
<ul>
{% for category in categories %}
<li>{{ category.name }}</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
Is probably what you want, or if you only want the first category with its children:
{% if categories %}
<h3>{{ text_refine }}</h3>
<div class="row">
<div class="col-sm-3">
<ul>
{% for child in category %}
<li>{{ child.name }}</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
I have custom registration form with my own registration view. I've started to using django-allauth recently and I would like to add email confirmation to my registration. Is it possible?
registration view:
def registration(request):
user_creation_form = UserProfileCreationForm(request.POST or None)
if request.method == 'POST':
if user_creation_form.is_valid():
user_creation_form.save()
username = user_creation_form.cleaned_data['username']
password = user_creation_form.cleaned_data['password2']
user = authenticate(username=username, password=password)
login(request, user)
messages.add_message(request, messages.SUCCESS, YOU_HAVE_BEEN_REGISTERED)
return HttpResponseRedirect(reverse('homepage'))
return render(request, 'dolava/accounts/registration.html',
context={'user_creation_form': user_creation_form})
This is how rewrite allauth templates:
in SETTINGS.PY
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates','allauth'),)
main app templates:
templates/account/password_reset.html (overriden allauth templates)
The problem is that I want to have many fields in registration template like type_of_user, telephone etc.
registration.html:
{% extends 'base.html' %}
{% load static %}
{% block head %}
<script src="{% static "js/registrationToggleFields.js" %}"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#id_country').select2();
$('#id_telephone_0').select2();
});
</script>
{% endblock %}
{% block content %}
<div class="col-md-12 text-center">
<h2>Register your account</h2>
<hr class="col-md-12 blackhr no-bottom-margin">
</div>
{# <div class="col-md-12 text-center center-block">#}
<form action="" method="post" class="col-md-6 col-md-offset-3" id="register-form">
{% csrf_token %}
{{ user_creation_form.non_field_errors }}
<div id="form-account-type">
<h3 align="center" class="main-color">Account Type</h3>
<hr>
{# <div class="col-md-12">#}
<div id="type-of-user-field-wrapper" class="fieldWrapper">
<div>
<label for="{{ user_creation_form.type_of_user.id_for_label }}">Type of user:</label>
{% if user_creation_form.type_of_user.field.required %} * {% endif %}
</div>
{{ user_creation_form.type_of_user }}
{{ user_creation_form.type_of_user.errors }}
</div>
<div id="country-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.country.id_for_label }}">Country:</label>
{% if user_creation_form.country.field.required %} * {% endif %}
<br>
{{ user_creation_form.country }}
{{ user_creation_form.country.errors }}
</div>
{# </div>#}
<hr>
</div>
<div id="form-login-credentials" class="form-group-container show-allways">
<h3 align="center" class="main-color">Credentials</h3>
<hr>
<div>
<div id="username-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.username.id_for_label }}">Username:</label>
{% if user_creation_form.username.field.required %} * {% endif %}
<br>
{{ user_creation_form.username }}
{{ user_creation_form.username.errors }}
</div>
<div id="password1-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.password1.id_for_label }}">Password:</label>
{% if user_creation_form.password1.field.required %} * {% endif %}
<br>
{{ user_creation_form.password1 }}
{{ user_creation_form.password1.errors }}
</div>
<div id="password2-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.password2.id_for_label }}">Confirm your password:</label>
{% if user_creation_form.password2.field.required %} * {% endif %}
<br>
{{ user_creation_form.password2 }}
{{ user_creation_form.password2.errors }}
</div>
</div>
<hr>
</div>
<div id="form-personal-information" class="form-group-container show-personal">
<h3 align="center" class="main-color">Personal information</h3>
<hr>
<div>
<div id="first-name-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.first_name.id_for_label }}">First name:</label>
{% if user_creation_form.first_name.field.required %} * {% endif %}
<br>
{{ user_creation_form.first_name }}
{{ user_creation_form.first_name.errors }}
</div>
<div id="last-name-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.last_name.id_for_label }}">Last name:</label>
{% if user_creation_form.last_name.field.required %} * {% endif %}
<br>
{{ user_creation_form.last_name }}
{{ user_creation_form.last_name.errors }}
</div>
</div>
<hr>
</div>
<div id="form-company-information" class="form-group-container show-company-sk show-company">
<h3 align="center" class="main-color">Company information</h3>
<hr>
<div>
<div id="company-name-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.company_name.id_for_label }}">Company name:</label>
{% if user_creation_form.company_name.field.required %} * {% endif %}
<br>
{{ user_creation_form.company_name }}
{{ user_creation_form.company_name.errors }}
</div>
<div id="address-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.address.id_for_label }}">Address:</label>
{% if user_creation_form.address.field.required %} * {% endif %}
<br>
{{ user_creation_form.address }}
{{ user_creation_form.address.errors }}
</div>
</div>
<hr>
</div>
<div id="form-billing-information" class="form-group-container show-company-sk">
<h3 align="center" class="main-color">Billing information</h3>
<hr>
<div>
<div id="ico-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.ICO.id_for_label }}">IČO:</label>
{% if user_creation_form.ICO.field.required %} * {% endif %}
<br>
{{ user_creation_form.ICO }}
{{ user_creation_form.ICO.errors }}
</div>
<div id="dic-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.DIC.id_for_label }}">DIČ:</label>
{% if user_creation_form.DIC.field.required %} * {% endif %}
<br>
{{ user_creation_form.DIC }}
{{ user_creation_form.DIC.errors }}
</div>
</div>
<hr>
</div>
<div id="form-contact-information" class="form-group-container show-allways">
<h3 align="center" class="main-color">Contact information</h3>
<hr>
<div>
<div id="email-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.email.id_for_label }}">Email:</label>
{% if user_creation_form.email.field.required %} * {% endif %}
<br>
{{ user_creation_form.email }}
{{ user_creation_form.email.errors }}
</div>
<div id="telephone-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.telephone.id_for_label }}">Telephone:</label>
{% if user_creation_form.telephone.field.required %} * {% endif %}
<br>
{{ user_creation_form.telephone }}
{{ user_creation_form.telephone.errors }}
</div>
<div id="fax-field-wrapper" class="fieldWrapper">
<label for="{{ user_creation_form.fax.id_for_label }}">Fax:</label>
{% if user_creation_form.fax.field.required %} * {% endif %}
<br>
{{ user_creation_form.fax }}
{{ user_creation_form.fax.errors }}
</div>
</div>
</div>
<div class=" clearfix top-margin">
<button class="btn btn-success center-block" style="width:100%; padding: 15px 0;" type="submit">
Register
</button>
</div>
</form>
{# </div>#}
{% endblock %}
Do you have any advices?
You have to override one class and then supply all required variables to thhe specific template. The view that returns confirmation_email is ConfirmEmailView of allauth/account/views.py override this class, pass all the required variables from view to the template and then override your template account/email_confirm to show required data.
Is there a better way to set a 'has-error' class within my form fields? I am using Flask and WTForms. The below code works but is very repetitive. I tried to set a dynamic variable such as {% set field + 'error' = 'has-error' %} but found out you cannot set dynamic variables in jinja.
<form action="{{ url_for_security('login') }}" method="POST" name="login_user_form">
{% if login_user_form.email.errors %}
{% set email_error = 'has-error' %}
{% endif %}
{% if login_user_form.password.errors %}
{% set password_error = 'has-error' %}
{% endif %}
<div class="form-group {{ email_error }}">
{{ login_user_form.email(class='form-control input-lg', placeholder='Email', required='true') }}
{% if login_user_form.email.errors %}
{% for error in login_user_form.email.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %}
</div> <!-- / Email -->
<div class="form-group signin-password {{ password_error }}">
{{ login_user_form.password(class='form-control input-lg', placeholder='Password', required='true') }}
{% if login_user_form.password.errors %}
{% for error in login_user_form.password.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %}
</div> <!-- / Password -->
<div class="form-actions">
<input type="submit" value="Log In" class="btn btn-primary btn-block btn-lg">
</div> <!-- / .form-actions -->
</form>
I want to display the number of objects returned from query search. I have tried
{{ p.count }} and {{ Post.count }}
Here is my post_list.html. I have read other posts that use those methods and they do not work for me. I know I am missing something.
{% extends 'posts/base.html' %}
{% block content %}
<div class="col-sm-6 col-sm-offset-3">
<h1>{{ title }}</h1>
<form method="get" action=" ">
<input type="text" name="q" placeholder="search" value="{{ request.GET.q }}"/>
<input type="submit" value=" search"/>
</form>
create
{% for p in queryset %}
<div class="row">
<div class="col-sm-12 "> <!-- i like col-sm-6 -->
<div class="thumbnail">
{% if p.image %}
<img src='{{ p.image.url }}' class="img-responsive" />
{% endif %}
<!--<img src="..." alt="...">-->
<div class="caption">
{% if p.draft %} <h3>Staff Only: Draft</h3> {% if p.publish > today %}<h3>Staff Only: Future Post</h3> {% endif %}
{% endif %}
<h3><a href='{{ p.get_absolute_url}}'>{{p.title}}</a> <small>{{p.publish | timesince }} </small> </h3>
{% if p.user.get_full_name %}<p>Author: {{ p.user.get_full_name }}</p>{% endif %}
<p>{{p.content | truncatechars:30}}</p>
<p>View
{% if user.is_authenticated %}
edit
delete
{% endif %}
</p>
</div>
</div>
</div>
<hr>
</div>
{% endfor %}
<div class="pagination">
<span class="step-links">
{% if queryset.has_previous %}
previous
{% endif %}
<span class="current">
Page {{ queryset.number }} of {{ queryset.paginator.num_pages }}.
</span>
{% if queryset.has_next %}
next
{% endif %}
</span>
</div>
</div>
{% endblock content %}
Any help will be greatly appreciated. Thanks
You cannot do count on a single object p, because there's no count for that. Only queryset has count method, so do:
{{ queryset.count }}
You'll want to use the the built-in filter length
Returns the length of the value. This works for both strings and lists.
You can use it within your template to get the length of any object
{{ queryset|length }}
I have the following code. The first works, however the second throws a "MultiValueDictKeyError". I've tweaked the code around a bit but I haven't been able to fix it. Any and all help is greatly appreciated!
Working Code:
{% extends "base.html" %}
{% block base_content %}
<link rel="stylesheet" href="/media/themes/txt/css/employee_summary/report.css" />
<form id="myForm" method="post">
{% csrf_token %}
{% for field in form %}
<div class=box>
<div class="row">
<div class="2u">
<h1>{{ field.label_tag }}:</h1>
</div>
<div class="10u">
{{ field }}
</div>
</div>
</div>
{% endfor %}
{% for formset in inlines %}
<div class=box>
{% for form in formset %}
<div class="row">
<div class="12u">
<h1>{{ form }}</h1>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
{% for formset in inlines %}
{{ formset.management_form }}
{% endfor %}
<input type="submit" value="Save Changes">
</form>
{% endblock %}
Non-Working Code:
{% extends "base.html" %}
{% block base_content %}
<link rel="stylesheet" href="/media/themes/txt/css/employee_summary/report.css" />
<div id="main-wrapper">
<div class="strongborder">
<div id="main" class="container boldtext">
<form id="myForm" method="post" class="12u">
{% csrf_token %}
{% for field in form %}
<div class="row">
<div class="2u">
<h1>{{ field.label_tag }}:</h1>
</div>
<div class="10u">
{{ field }}
</div>
</div>
{% endfor %}
{% for formset in inlines %}
{% for form in formset %}
<br>
<br>
<h1>{{ form.instance.form_name }}</h1>
{% for field in form %}
<div class="row">
{% if field.label != "Employee" and field.label != "Id" and field.label != "Delete" %}
<label class="2u">{{ field.label }}:</label>
<div class="10u">{{ field }}</div>
{% endif %}
</div>
{% endfor %}
{% endfor %}
{% endfor %}
{% for formset in inlines %}
{{ formset.management_form }}
{% endfor %}
<br>
<br>
<input type="submit" value="Save Changes">
</form>
</div>
</div>
</div>
{% endblock %}
Solved by myself: for some reason it wasn't liking the ID skip in
{% if field.label != "Employee" and field.label != "Id" and field.label != "Delete" %}
... yet it was fine with skipping the employee and delete fields.