I have two models, one of which is working perfectly, and another which is not allowing me to visit the edits page. These models are almost the exact same outside of the fact that one of them has their own page to view individual instances, and the other does not. For some reason I cannot visit the edit page for the model without its own pages. I am almost positive there is a small error I am missing but I just need another set of eyes to assist me. Code below, if you need more information please let me know.
#urls page
from django.urls import path
from . import views
app_name = 'barbershop_site'
urlpatterns = [
#this is the home page for the website
path('', views.index, name="index"),
#page that shows all of the barbers
path('barbers/', views.barbers, name="barbers"),
#page that shows all of the pricingoptions
path('pricing/', views.pricing, name="pricing"),
#page that shows individual barbers on their own page
path('barbers/<int:barber_id>/', views.barber, name="barber"),
#page that has a bunch of contact information, and social media links
path('contact/', views.contact, name="contact"),
#page for adding a new barber
path('new_barber/', views.new_barber, name="new_barber"),
#path to add a new haircut option
path('new_haircutoption/', views.new_haircutoption, name="new_haircutoption"),
#path for editing barbers
path('edit_barber/<int:barber_id>/', views.edit_barber, name="edit_barber"),
#path for editing haircut options
path('edit_haircutoption/<int:haircutoption_id>/', views.edit_haircutoption, name="edit_haircutoption"),
]
#views page
from django.shortcuts import render, redirect
from .models import Barber, HaircutOptions
from .forms import BarberForm, HaircutOptionForm
from django.contrib.auth.decorators import login_required
#skipped the other views
#view function for editing haircut options
@login_required
def edit_haircutoption(request, haircutoption_id):
#edit an existing barbers information
haircutoption = HaircutOptions.objects.get(id=haircutoption_id)
if request.method != 'POST':
#initial request, pre fill form with the current barber
form = HaircutOptionForm(instance=haircutoption)
else:
#post data submitted, process data
form = HaircutOptionForm(instance=haircutoption, data=request.POST)
if form.is_valid():
form.save()
return redirect('barbershop_site:pricing')
context = {'haircutoption': haircutoption, 'form': form}
return render(request, 'barbershop_site/edit_haircutoption.html', context)
<!--form for editing existing haircut option-->
{% extends 'barbershop_site/base.html' %}
{% block page_header %}
<h1>Make changes below:</h1>
{% endblock page_header %}
{% block content %}
<form action="{% url 'barbershop_site:edit_haircutoption'
haircutoption.id %}" method = 'post'>
{%csrf_token%}
{{form.as_p}}
<button name="submit">Save changes</button>
</form>
{% endblock content %}