form code placeholders left commented-out in apps.dashboard.views; base.html somewhat retrofitted w. dynamic form views
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.shortcuts import redirect, render
|
||||
from .forms import ItemForm
|
||||
from .models import Item, List
|
||||
|
||||
def home_page(request):
|
||||
return render(request, 'apps/dashboard/home.html')
|
||||
# return render(request, 'apps/dashboard/home.html', {"form": ItemForm()})
|
||||
return render(request, "apps/dashboard/home.html")
|
||||
|
||||
def new_list(request):
|
||||
nulist = List.objects.create()
|
||||
|
||||
@@ -18,12 +18,16 @@
|
||||
<h2 class="display-2 mb-2">{% block header_text %}{% endblock header_text %}</h2>
|
||||
|
||||
<form method="POST" action="{% block form_action %}{% endblock form_action %}">
|
||||
{% if form %}
|
||||
{{ form.text }}
|
||||
{% else %}
|
||||
<input
|
||||
class="form-control form-control-lg{% if error %} is-invalid{% endif %}"
|
||||
name="item_text"
|
||||
id="id-new-item"
|
||||
class="form-control form-control-lg {% if error %}is-invalid{% endif %}"
|
||||
placeholder="Enter a to-do item"
|
||||
/>
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
{% if error %}
|
||||
<div class="invalid-feedback">{{ error }}</div>
|
||||
|
||||
Reference in New Issue
Block a user