apps.dashboard.forms now employed in all views; FT helpers in base.py updated to look for Django's default #id_text (instead of #id-text)
This commit is contained in:
@@ -17,18 +17,12 @@ def new_list(request):
|
||||
|
||||
def view_list(request, list_id):
|
||||
our_list = List.objects.get(id=list_id)
|
||||
error = None
|
||||
form = ItemForm()
|
||||
|
||||
if request.method == "POST":
|
||||
form = ItemForm(data=request.POST)
|
||||
try:
|
||||
item = Item(text=request.POST['text'], list=our_list)
|
||||
item.full_clean()
|
||||
item.save()
|
||||
if form.is_valid():
|
||||
Item.objects.create(text=request.POST["text"], list=our_list)
|
||||
return redirect(our_list)
|
||||
except ValidationError:
|
||||
error = "You can't have an empty list item"
|
||||
|
||||
return render(request, 'apps/dashboard/list.html', {'list': our_list, "form": form, "error": error})
|
||||
return render(request, 'apps/dashboard/list.html', {'list': our_list, "form": form})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user