Merge pull request 'feature/boxform' (#2) from feature/boxform into master
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 9s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 8s
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 9s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 8s
Reviewed-on: #2
This commit is contained in:
@@ -27,7 +27,7 @@ spec:
|
||||
mountPath: /data
|
||||
containers:
|
||||
- name: web
|
||||
image: git.baumann.gr/adebaumann/labhelper:0.024
|
||||
image: git.baumann.gr/adebaumann/labhelper:0.025
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
|
||||
@@ -12,7 +12,7 @@ class ThingForm(forms.ModelForm):
|
||||
widgets = {
|
||||
'name': forms.TextInput(attrs={'class': 'form-control'}),
|
||||
'thing_type': forms.Select(attrs={'class': 'form-control'}),
|
||||
'description': forms.Textarea(attrs={'class': 'form-control', 'rows': 2}),
|
||||
'description': forms.Textarea(attrs={'class': 'form-control', 'rows': 4}),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -162,9 +162,7 @@
|
||||
{{ form.name }}
|
||||
{% for error in form.name.errors %}
|
||||
<div class="error-list">
|
||||
{% for e in error %}
|
||||
<li>{{ e }}</li>
|
||||
{% endfor %}
|
||||
<li>{{ error }}</li>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<label class="required">*</label>
|
||||
@@ -173,9 +171,7 @@
|
||||
{{ form.thing_type }}
|
||||
{% for error in form.thing_type.errors %}
|
||||
<div class="error-list">
|
||||
{% for e in error %}
|
||||
<li>{{ e }}</li>
|
||||
{% endfor %}
|
||||
<li>{{ error }}</li>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<label class="required">*</label>
|
||||
@@ -184,9 +180,7 @@
|
||||
{{ form.description }}
|
||||
{% for error in form.description.errors %}
|
||||
<div class="error-list">
|
||||
{% for e in error %}
|
||||
<li>{{ e }}</li>
|
||||
{% endfor %}
|
||||
<li>{{ error }}</li>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</td>
|
||||
@@ -194,9 +188,7 @@
|
||||
{{ form.picture }}
|
||||
{% for error in form.picture.errors %}
|
||||
<div class="error-list">
|
||||
{% for e in error %}
|
||||
<li>{{ e }}</li>
|
||||
{% endfor %}
|
||||
<li>{{ error }}</li>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</td>
|
||||
@@ -210,6 +202,12 @@
|
||||
</table>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if success_message %}
|
||||
<div class="success-message">
|
||||
{{ success_message }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -62,6 +62,8 @@ def add_things(request, box_id):
|
||||
"""Add multiple things to a box at once."""
|
||||
box = get_object_or_404(Box, pk=box_id)
|
||||
|
||||
success_message = None
|
||||
|
||||
if request.method == 'POST':
|
||||
formset = ThingFormSet(request.POST)
|
||||
|
||||
@@ -73,17 +75,12 @@ def add_things(request, box_id):
|
||||
thing.box = box
|
||||
thing.save()
|
||||
created_count += 1
|
||||
print(f'DEBUG: created_count={created_count}')
|
||||
if created_count > 0:
|
||||
print(f'DEBUG: Redirecting to box_detail with box_id={box_id}')
|
||||
return redirect('box_detail', box_id=box_id)
|
||||
else:
|
||||
print('DEBUG: No valid data submitted')
|
||||
|
||||
else:
|
||||
success_message = f'Added {created_count} thing{"s" if created_count > 1 else ""} successfully.'
|
||||
formset = ThingFormSet()
|
||||
|
||||
return render(request, 'boxes/add_things.html', {
|
||||
'box': box,
|
||||
'formset': formset,
|
||||
'success_message': success_message,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user