hundreds-camera-24900
12/08/2021, 12:44 AMhundreds-camera-24900
12/08/2021, 12:45 AMhundreds-camera-24900
12/08/2021, 12:45 AMhundreds-camera-24900
12/08/2021, 12:46 AMhundreds-camera-24900
12/08/2021, 12:46 AMmysterious-toddler-20573
12/08/2021, 4:01 AMmysterious-toddler-20573
12/08/2021, 4:02 AMmonitorEvents
trick mentioned here: https://htmx.org/docs/#debuggingmysterious-toddler-20573
12/08/2021, 4:02 AMmysterious-toddler-20573
12/08/2021, 4:02 AMmysterious-toddler-20573
12/08/2021, 4:02 AMmysterious-toddler-20573
12/08/2021, 4:02 AMfast-baker-86727
12/08/2021, 4:48 PMmysterious-toddler-20573
12/08/2021, 5:18 PMhx-include='closest tr'
on the button and then put hx-post
directly on the buttonfast-baker-86727
12/08/2021, 5:36 PMdjango-htmx
middleware, which would have exposed that to me right away, totally my bad).
The form successfully POSTs--I can see this in the django console, and the data is also actually updated, which I can confirm on subsequent load. So, it looks like the form is working fine.fast-baker-86727
12/08/2021, 5:36 PMfast-baker-86727
12/08/2021, 5:36 PMclass Ingredients(LoginRequiredMixin, ListView):
template_name = "inventory/ingredients.html"
model = models.Ingredient
extra_context = {'active_nav_pantry': "active"}
class HtmxIngredient(DetailView):
template_name = 'htmx/ingredient.html'
model = models.Ingredient
class UpdateIngredient(LoginRequiredMixin, UpdateView):
template_name = "inventory/update_ingredient.html"
model = models.Ingredient
form_class = forms.IngredientForm
extra_context = {'active_nav_pantry': "active"}
class HtmxUpdateIngredient(UpdateIngredient):
template_name = 'htmx/update_ingredient.html'
def get_success_url(self):
reverse_lazy('htmx_ingredient', args=self.object.pk)
URL patterns:
path('ingredients/', views.Ingredients.as_view(), name="ingredients"),
path('ingredients/<pk>/', views.UpdateIngredient.as_view(), name="update_ingredient"),
path('ingredients/htmx/edit/<pk>', views.HtmxUpdateIngredient.as_view(), name="htmx_update_ingredient"),
path('ingredients/htmx/display/<pk>', views.HtmxIngredient.as_view(), name="htmx_ingredient"),
Again, Django noob here, so please point out if I've made some glaring mistake.fast-baker-86727
12/08/2021, 5:44 PMget_success_url
methodfast-baker-86727
12/08/2021, 6:03 PMfast-baker-86727
12/08/2021, 6:03 PMreturn
statement in the get_success_url
methodfast-baker-86727
12/08/2021, 6:04 PMfast-baker-86727
12/08/2021, 6:11 PMhx-include='closest tr'
worked like a charm 😙 🤌adamant-pencil-3809
12/10/2021, 12:22 PMsilly-airline-58853
12/11/2021, 4:15 PMmysterious-toddler-20573
12/11/2021, 4:36 PMsilly-airline-58853
12/11/2021, 5:01 PMmysterious-toddler-20573
12/11/2021, 5:03 PMmysterious-toddler-20573
12/11/2021, 5:03 PMenough-grass-99356
12/11/2021, 6:04 PMsilly-airline-58853
12/11/2021, 9:49 PMmillions-morning-77621
12/12/2021, 10:04 AM